34 const VERSION =
'8.0.13';
36 const SCALE = 72 / 25.4;
76 var $PDFAversion =
'1-B';
831 private $preambleWritten =
false;
836 private $fontDescriptor;
866 private $tableOfContents;
876 private $directWrite;
891 private $fontFileFinder;
912 private $sizeConverter;
917 private $colorConverter;
922 private $colorModeConverter;
927 private $colorSpaceRestrictor;
942 private $remoteContentFetcher;
947 private $imageProcessor;
952 private $languageToFont;
957 private $scriptToLanguage;
977 private $metadataWriter;
982 private $imageWriter;
997 private $bookmarkWriter;
1002 private $optionalContentWriter;
1007 private $colorWriter;
1012 private $backgroundWriter;
1017 private $javaScriptWriter;
1022 private $resourceWriter;
1048 ) = $this->initConstructorParams($config);
1052 $originalConfig = $config;
1053 $config = $this->initConfig($originalConfig);
1056 $services = $serviceFactory->getServices(
1060 $this->restrictColorSpace,
1061 $this->languageToFont,
1062 $this->scriptToLanguage,
1063 $this->fontDescriptor,
1069 $this->services = [];
1071 foreach ($services as $key => $service) {
1072 $this->{$key} = $service;
1073 $this->services[] = $key;
1076 $this->time0 = microtime(
true);
1078 $this->writingToC =
false;
1081 $this->current_layer = 0;
1082 $this->open_layer_pane =
false;
1084 $this->visibility =
'visible';
1086 $this->tableBackgrounds = [];
1087 $this->uniqstr =
'20110230';
1090 $this->BMPonly = [];
1094 $this->objectbuffer = [];
1096 $this->OrientationChanges = [];
1099 $this->FontFiles = [];
1102 $this->InFooter =
false;
1103 $this->processingFooter =
false;
1104 $this->processingHeader =
false;
1106 $this->FontFamily =
'';
1107 $this->FontStyle =
'';
1108 $this->FontSizePt = 9;
1111 $this->inMeter =
false;
1112 $this->decimal_offset = 0;
1114 $this->PDFAXwarnings = [];
1116 $this->defTextColor = $this->TextColor = $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings),
true);
1117 $this->defDrawColor = $this->DrawColor = $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings),
true);
1118 $this->defFillColor = $this->FillColor = $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings),
true);
1120 $this->upperCase = require __DIR__ .
'/../data/upperCase.php';
1122 $this->extrapagebreak =
true;
1124 $this->ColorFlag =
false;
1125 $this->extgstates = [];
1127 $this->mb_enc =
'windows-1252';
1128 $this->originalMbEnc = mb_internal_encoding();
1129 $this->originalMbRegexEnc = mb_regex_encoding();
1131 $this->directionality =
'ltr';
1132 $this->defaultAlign =
'L';
1133 $this->defaultTableAlign =
'L';
1135 $this->fixedPosBlockSave = [];
1136 $this->extraFontSubsets = 0;
1138 $this->blockContext = 1;
1139 $this->floatDivs = [];
1140 $this->DisplayPreferences =
'';
1143 $this->patterns = [];
1144 $this->pageBackgrounds = [];
1145 $this->gradients = [];
1148 $this->writingHTMLheader =
false;
1150 $this->writingHTMLfooter =
false;
1152 $this->kwt_Reference = [];
1153 $this->kwt_BMoutlines = [];
1154 $this->kwt_toc = [];
1156 $this->tbrot_BMoutlines = [];
1157 $this->tbrot_toc = [];
1159 $this->col_BMoutlines = [];
1160 $this->col_toc = [];
1163 $this->PDFAXwarnings = [];
1164 $this->inlineDisplayOff =
false;
1165 $this->lSpacingCSS =
'';
1166 $this->wSpacingCSS =
'';
1167 $this->fixedlSpacing =
false;
1168 $this->minwSpacing = 0;
1171 $this->baselineC = 0.35;
1176 $this->baselineSup = 0.5;
1179 $this->baselineSub = -0.2;
1181 $this->baselineS = 0.3;
1183 $this->baselineO = 1.1;
1185 $this->noImageFile = __DIR__ .
'/../data/no_image.jpg';
1188 $this->fullImageHeight =
false;
1189 $this->floatbuffer = [];
1190 $this->floatmargins = [];
1191 $this->formobjects = [];
1192 $this->InlineProperties = [];
1193 $this->InlineAnnots = [];
1194 $this->InlineBDF = [];
1195 $this->InlineBDFctr = 0;
1196 $this->tbrot_Annots = [];
1197 $this->kwt_Annots = [];
1198 $this->columnAnnots = [];
1199 $this->PageLinks = [];
1200 $this->OrientationChanges = [];
1201 $this->pageDim = [];
1202 $this->saveHTMLHeader = [];
1203 $this->saveHTMLFooter = [];
1204 $this->PageAnnots = [];
1205 $this->PageNumSubstitutions = [];
1206 $this->breakpoints = [];
1207 $this->tableLevel = 0;
1209 $this->page_box = [];
1210 $this->show_marks =
'';
1212 $this->kwt_height = 0;
1215 $this->kwt_buffer = [];
1216 $this->kwt_Links = [];
1217 $this->kwt_moved =
false;
1218 $this->kwt_saved =
false;
1219 $this->PageNumSubstitutions = [];
1220 $this->base_table_properties = [];
1221 $this->borderstyles = [
'inset',
'groove',
'outset',
'ridge',
'dotted',
'dashed',
'solid',
'double'];
1222 $this->tbrot_align =
'C';
1224 $this->pageHTMLheaders = [];
1225 $this->pageHTMLfooters = [];
1226 $this->HTMLheaderPageLinks = [];
1227 $this->HTMLheaderPageAnnots = [];
1229 $this->HTMLheaderPageForms = [];
1230 $this->columnForms = [];
1231 $this->tbrotForms = [];
1233 $this->pageoutput = [];
1235 $this->bufferoutput =
false;
1237 $this->encrypted =
false;
1239 $this->BMoutlines = [];
1240 $this->ColActive = 0;
1241 $this->Reference = [];
1245 $this->ChangeColumn = 0;
1246 $this->columnbuffer = [];
1247 $this->ColDetails = [];
1248 $this->columnLinks = [];
1249 $this->substitute = [];
1250 $this->entsearch = [];
1251 $this->entsubstitute = [];
1252 $this->lastoptionaltag =
'';
1253 $this->charset_in =
'';
1259 $this->ispre =
false;
1261 $this->checkSIP =
false;
1262 $this->checkSMP =
false;
1263 $this->checkCJK =
false;
1265 $this->page_break_after_avoid =
false;
1266 $this->margin_bottom_collapse =
false;
1267 $this->tablethead = 0;
1268 $this->tabletfoot = 0;
1269 $this->table_border_attr_set = 0;
1270 $this->table_border_css_set = 0;
1271 $this->shrin_k = 1.0;
1272 $this->shrink_this_table_to_fit = 0;
1273 $this->MarginCorrection = 0;
1275 $this->tabletheadjustfinished =
false;
1276 $this->usingCoreFont =
false;
1277 $this->charspacing = 0;
1279 $this->autoPageBreak =
true;
1281 $this->_setPageSize($format, $orientation);
1282 $this->DefOrientation = $orientation;
1284 $this->margin_header = $mgh;
1285 $this->margin_footer = $mgf;
1289 $this->DeflMargin = $mgl;
1290 $this->DefrMargin = $mgr;
1292 $this->orig_tMargin = $mgt;
1293 $this->orig_bMargin = $bmargin;
1294 $this->orig_lMargin = $this->DeflMargin;
1295 $this->orig_rMargin = $this->DefrMargin;
1296 $this->orig_hMargin = $this->margin_header;
1297 $this->orig_fMargin = $this->margin_footer;
1299 if ($this->setAutoTopMargin ==
'pad') {
1300 $mgt += $this->margin_header;
1302 if ($this->setAutoBottomMargin ==
'pad') {
1303 $mgb += $this->margin_footer;
1307 $this->SetMargins($this->DeflMargin, $this->DefrMargin, $mgt);
1311 $this->SetAutoPageBreak($this->autoPageBreak, $bmargin);
1313 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
1316 $this->cMarginL = 1;
1317 $this->cMarginR = 1;
1320 $this->LineWidth = .567 / Mpdf::SCALE;
1323 $this->DisableTags();
1325 $this->SetDisplayMode(100);
1328 $this->SetCompression(
true);
1330 $this->SetDisplayPreferences(
'');
1332 $this->initFontConfig($originalConfig);
1335 $this->available_unifonts = [];
1336 foreach ($this->fontdata as $f => $fs) {
1337 if (isset($fs[
'R']) && $fs[
'R']) {
1338 $this->available_unifonts[] = $f;
1340 if (isset($fs[
'B']) && $fs[
'B']) {
1341 $this->available_unifonts[] = $f .
'B';
1343 if (isset($fs[
'I']) && $fs[
'I']) {
1344 $this->available_unifonts[] = $f .
'I';
1346 if (isset($fs[
'BI']) && $fs[
'BI']) {
1347 $this->available_unifonts[] = $f .
'BI';
1351 $this->default_available_fonts = $this->available_unifonts;
1354 $onlyCoreFonts =
false;
1355 if (preg_match(
'/([\-+])aCJK/i', $mode, $m)) {
1356 $mode = preg_replace(
'/([\-+])aCJK/i',
'', $mode);
1358 $this->useAdobeCJK =
true;
1360 $this->useAdobeCJK =
false;
1364 if (strlen($mode) == 1) {
1366 $this->percentSubset = 100;
1368 } elseif ($mode ==
'c') {
1369 $onlyCoreFonts =
true;
1372 } elseif (substr($mode, -2) ==
'-s') {
1373 $this->percentSubset = 100;
1374 $mode = substr($mode, 0, strlen($mode) - 2);
1375 } elseif (substr($mode, -2) ==
'-c') {
1376 $onlyCoreFonts =
true;
1377 $mode = substr($mode, 0, strlen($mode) - 2);
1378 } elseif (substr($mode, -2) ==
'-x') {
1380 $mode = substr($mode, 0, strlen($mode) - 2);
1384 if ($mode && $mode !=
'UTF-8') {
1385 list ($coreSuitable, $mpdf_pdf_unifont) = $this->languageToFont->getLanguageOptions($mode, $this->useAdobeCJK);
1386 if ($coreSuitable && $optcore) {
1387 $onlyCoreFonts =
true;
1389 if ($mpdf_pdf_unifont) {
1390 $default_font = $mpdf_pdf_unifont;
1392 $this->currentLang = $mode;
1393 $this->default_lang = $mode;
1396 $this->onlyCoreFonts = $onlyCoreFonts;
1398 if ($this->onlyCoreFonts) {
1399 $this->setMBencoding(
'windows-1252');
1401 $this->setMBencoding(
'UTF-8');
1403 @mb_regex_encoding(
'UTF-8');
1406 $this->available_CJK_fonts = [
1426 $this->CoreFonts = [
1427 'ccourier' =>
'Courier',
1428 'ccourierB' =>
'Courier-Bold',
1429 'ccourierI' =>
'Courier-Oblique',
1430 'ccourierBI' =>
'Courier-BoldOblique',
1431 'chelvetica' =>
'Helvetica',
1432 'chelveticaB' =>
'Helvetica-Bold',
1433 'chelveticaI' =>
'Helvetica-Oblique',
1434 'chelveticaBI' =>
'Helvetica-BoldOblique',
1435 'ctimes' =>
'Times-Roman',
1436 'ctimesB' =>
'Times-Bold',
1437 'ctimesI' =>
'Times-Italic',
1438 'ctimesBI' =>
'Times-BoldItalic',
1439 'csymbol' =>
'Symbol',
1440 'czapfdingbats' =>
'ZapfDingbats'
1452 $this->setHiEntitySubstitutions();
1454 if ($this->onlyCoreFonts) {
1455 $this->useSubstitutions =
true;
1456 $this->SetSubstitutions();
1458 $this->useSubstitutions = $config[
'useSubstitutions'];
1461 if (file_exists($this->defaultCssFile)) {
1462 $css = file_get_contents($this->defaultCssFile);
1463 $this->cssManager->ReadCSS(
'<style> ' . $css .
' </style>');
1465 throw new \Mpdf\MpdfException(sprintf(
'Unable to read default CSS file "%s"', $this->defaultCssFile));
1468 if ($default_font ==
'') {
1469 if ($this->onlyCoreFonts) {
1470 if (in_array(strtolower($this->defaultCSS[
'BODY'][
'FONT-FAMILY']), $this->mono_fonts)) {
1471 $default_font =
'ccourier';
1472 } elseif (in_array(strtolower($this->defaultCSS[
'BODY'][
'FONT-FAMILY']), $this->sans_fonts)) {
1473 $default_font =
'chelvetica';
1475 $default_font =
'ctimes';
1478 $default_font = $this->defaultCSS[
'BODY'][
'FONT-FAMILY'];
1481 if (!$default_font_size) {
1482 $mmsize = $this->sizeConverter->convert($this->defaultCSS[
'BODY'][
'FONT-SIZE']);
1483 $default_font_size = $mmsize * (Mpdf::SCALE);
1486 if ($default_font) {
1487 $this->SetDefaultFont($default_font);
1489 if ($default_font_size) {
1490 $this->SetDefaultFontSize($default_font_size);
1493 $this->SetLineHeight();
1495 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
1503 $this->listtype = [];
1504 $this->listitem = [];
1505 $this->listcounter = [];
1507 $this->tdbegin =
false;
1512 $this->cellBorderBuffer = [];
1514 $this->divbegin =
false;
1516 $this->cellTextAlign =
'';
1517 $this->cellLineHeight =
'';
1518 $this->cellLineStackingStrategy =
'';
1519 $this->cellLineStackingShift =
'';
1521 $this->divwidth = 0;
1522 $this->divheight = 0;
1523 $this->spanbgcolor =
false;
1524 $this->spanborder =
false;
1525 $this->spanborddet = [];
1527 $this->blockjustfinished =
false;
1528 $this->ignorefollowingspaces =
true;
1529 $this->dash_on =
false;
1530 $this->dotted_on =
false;
1531 $this->textshadow =
'';
1533 $this->currentfontfamily =
'';
1534 $this->currentfontsize =
'';
1535 $this->currentfontstyle =
'';
1536 $this->colorarray =
'';
1537 $this->spanbgcolorarray =
'';
1538 $this->textbuffer = [];
1539 $this->internallink = [];
1540 $this->basepath =
"";
1542 $this->SetBasePath(
'');
1544 $this->textparam = [];
1546 $this->specialcontent =
'';
1547 $this->selectoption = [];
1552 mb_internal_encoding($this->originalMbEnc);
1553 @mb_regex_encoding($this->originalMbRegexEnc);
1556 foreach ($this->createdReaders as
$id) {
1557 $this->readers[
$id]->getParser()->getStreamReader()->cleanUp();
1558 unset($this->readers[
$id]);
1561 $this->createdReaders = [];
1571 $this->logger = $logger;
1573 foreach ($this->services as
$name) {
1574 if ($this->$name && $this->$name instanceof \Psr\Log\LoggerAwareInterface) {
1575 $this->$name->setLogger($logger);
1582 private function initConfig(array $config)
1585 $defaults = $configObject->getDefaults();
1586 $config = array_intersect_key($config + $defaults, $defaults);
1588 foreach ($config as $var => $val) {
1589 $this->{$var} = $val;
1595 private function initConstructorParams(array $config)
1600 'default_font_size' => 0,
1601 'default_font' =>
'',
1602 'margin_left' => 15,
1603 'margin_right' => 15,
1605 'margin_bottom' => 16,
1606 'margin_header' => 9,
1607 'margin_footer' => 9,
1608 'orientation' =>
'P',
1611 foreach ($constructor as $key => $val) {
1612 if (isset($config[$key])) {
1613 $constructor[$key] = $config[$key];
1617 return array_values($constructor);
1620 private function initFontConfig(array $config)
1622 $configObject =
new FontVariables();
1623 $defaults = $configObject->getDefaults();
1624 $config = array_intersect_key($config + $defaults, $defaults);
1625 foreach ($config as $var => $val) {
1626 $this->{$var} = $val;
1634 if (is_string($format)) {
1636 if (empty($format)) {
1641 if (preg_match(
'/([0-9a-zA-Z]*)-([P,L])/i', $format, $m)) {
1643 $orientation = $m[2];
1644 } elseif (empty($orientation)) {
1650 $this->fwPt = $format[0];
1651 $this->fhPt = $format[1];
1655 if (!$format[0] || !$format[1]) {
1656 throw new \Mpdf\MpdfException(
'Invalid page format: ' . $format[0] .
' ' . $format[1]);
1659 $this->fwPt = $format[0] * Mpdf::SCALE;
1660 $this->fhPt = $format[1] * Mpdf::SCALE;
1663 $this->fw = $this->fwPt / Mpdf::SCALE;
1664 $this->fh = $this->fhPt / Mpdf::SCALE;
1667 $orientation = strtolower($orientation);
1668 if ($orientation ===
'p' || $orientation ==
'portrait') {
1670 $this->wPt = $this->fwPt;
1671 $this->hPt = $this->fhPt;
1672 } elseif ($orientation ===
'l' || $orientation ==
'landscape') {
1674 $this->wPt = $this->fhPt;
1675 $this->hPt = $this->fwPt;
1677 throw new \Mpdf\MpdfException(
'Incorrect orientation: ' . $orientation);
1680 $this->CurOrientation = $orientation;
1682 $this->w = $this->wPt / Mpdf::SCALE;
1683 $this->h = $this->hPt / Mpdf::SCALE;
1690 $this->available_unifonts = $res;
1692 $this->available_unifonts = $this->default_available_fonts;
1694 if (count($this->available_unifonts) == 0) {
1695 $this->available_unifonts[] = $this->default_available_fonts[0];
1697 $this->available_unifonts = array_values($this->available_unifonts);
1702 if ($this->mb_enc != $enc) {
1703 $this->mb_enc = $enc;
1704 mb_internal_encoding($this->mb_enc);
1711 $this->lMargin = $left;
1712 $this->rMargin = $right;
1713 $this->tMargin = $top;
1719 if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation ==
'P' && $this->CurOrientation ==
'L') {
1720 if (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
1721 $this->tMargin = $this->orig_rMargin;
1722 $this->bMargin = $this->orig_lMargin;
1724 $this->tMargin = $this->orig_lMargin;
1725 $this->bMargin = $this->orig_rMargin;
1727 $this->lMargin = $this->DeflMargin;
1728 $this->rMargin = $this->DefrMargin;
1729 $this->MarginCorrection = 0;
1730 $this->PageBreakTrigger = $this->h - $this->bMargin;
1731 } elseif (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
1732 $this->lMargin = $this->DefrMargin;
1733 $this->rMargin = $this->DeflMargin;
1734 $this->MarginCorrection = $this->DefrMargin - $this->DeflMargin;
1736 $this->lMargin = $this->DeflMargin;
1737 $this->rMargin = $this->DefrMargin;
1738 if ($this->mirrorMargins) {
1739 $this->MarginCorrection = $this->DeflMargin - $this->DefrMargin;
1742 $this->x = $this->lMargin;
1748 $this->lMargin = $margin;
1749 if ($this->page > 0 and $this->x < $margin) {
1757 $this->tMargin = $margin;
1763 $this->rMargin = $margin;
1769 $this->autoPageBreak = $auto;
1770 $this->bMargin = $margin;
1771 $this->PageBreakTrigger = $this->h - $margin;
1776 $allowedZoomModes = [
'fullpage',
'fullwidth',
'real',
'default',
'none'];
1778 if (in_array($zoom, $allowedZoomModes,
true) || is_numeric($zoom)) {
1779 $this->ZoomMode = $zoom;
1781 throw new \Mpdf\MpdfException(
'Incorrect zoom display mode: ' . $zoom);
1784 $allowedLayoutModes = [
'single',
'continuous',
'two',
'twoleft',
'tworight',
'default'];
1786 if (in_array($layout, $allowedLayoutModes,
true)) {
1787 $this->LayoutMode = $layout;
1789 throw new \Mpdf\MpdfException(
'Incorrect layout display mode: ' . $layout);
1796 if (function_exists(
'gzcompress')) {
1797 $this->compress = $compress;
1799 $this->compress =
false;
1806 $this->title = $title;
1812 $this->subject = $subject;
1818 $this->author = $author;
1824 $this->keywords = $keywords;
1830 $this->creator = $creator;
1835 $this->customProperties[$key] = $value;
1863 $this->associatedFiles = $files;
1868 $this->additionalXmpRdf = $s;
1873 $this->anchor2Bookmark = $x;
1879 $this->aliasNbPg = $alias;
1885 $this->aliasNbPgGp = $alias;
1888 function SetAlpha($alpha, $bm =
'Normal', $return =
false, $mode =
'B')
1896 if (($this->PDFA || $this->PDFX) && $alpha != 1) {
1897 if (($this->PDFA && !$this->PDFAauto) || ($this->PDFX && !$this->PDFXauto)) {
1898 $this->PDFAXwarnings[] =
"Image opacity must be 100% (Opacity changed to 100%)";
1902 $a = [
'BM' =>
'/' . $bm];
1903 if ($mode ==
'F' || $mode ==
'B') {
1906 if ($mode ==
'S' || $mode ==
'B') {
1909 $gs = $this->AddExtGState($a);
1911 return sprintf(
'/GS%d gs', $gs);
1913 $this->writer->write(sprintf(
'/GS%d gs', $gs));
1919 $n = count($this->extgstates);
1921 for ($i = 1; $i <= $n; $i++) {
1922 if (count($this->extgstates[$i][
'parms']) == count($parms)) {
1924 foreach ($this->extgstates[$i][
'parms'] as $k => $v) {
1925 if (!isset($parms[$k]) || $parms[$k] != $v) {
1936 $this->extgstates[$n][
'parms'] = $parms;
1942 if (($this->PDFA || $this->PDFX) && $this->visibility !=
'visible') {
1943 $this->PDFAXwarnings[] =
"Cannot set visibility to anything other than full when using PDFA or PDFX";
1945 } elseif (!$this->PDFA && !$this->PDFX) {
1946 $this->pdf_version =
'1.5';
1948 if ($this->visibility !=
'visible') {
1949 $this->writer->write(
'EMC');
1950 $this->hasOC = intval($this->hasOC);
1952 if ($v ==
'printonly') {
1953 $this->writer->write(
'/OC /OC1 BDC');
1954 $this->hasOC = ($this->hasOC | 1);
1955 } elseif ($v ==
'screenonly') {
1956 $this->writer->write(
'/OC /OC2 BDC');
1957 $this->hasOC = ($this->hasOC | 2);
1958 } elseif ($v ==
'hidden') {
1959 $this->writer->write(
'/OC /OC3 BDC');
1960 $this->hasOC = ($this->hasOC | 4);
1961 } elseif ($v !=
'visible') {
1962 throw new \Mpdf\MpdfException(
'Incorrect visibility: ' . $v);
1964 $this->visibility = $v;
1970 if ($this->state == 0) {
1972 if (
false === $this->preambleWritten) {
1973 $this->writer->write(
'%PDF-' . $this->pdf_version);
1974 $this->writer->write(
'%' . chr(226) . chr(227) . chr(207) . chr(211));
1975 $this->preambleWritten =
true;
1985 if ($this->state == 3) {
1989 if ($this->page == 0) {
1990 $this->
AddPage($this->CurOrientation);
1993 if (count($this->cellBorderBuffer)) {
1994 $this->printcellbuffer();
1998 if ($this->tablebuffer) {
1999 $this->printtablebuffer();
2004 if ($this->ColActive) {
2005 $this->SetColumns(0);
2006 $this->ColActive = 0;
2007 if (count($this->columnbuffer)) {
2008 $this->printcolumnbuffer();
2017 $s .= $this->PrintBodyBackgrounds();
2018 $s .= $this->PrintPageBackgrounds();
2020 $this->pages[$this->page] = preg_replace(
2021 '/(___BACKGROUND___PATTERNS' . $this->uniqstr .
')/',
2022 "\n" . $s .
"\n" .
'\\1',
2023 $this->pages[$this->page]
2026 $this->pageBackgrounds = [];
2028 if ($this->visibility !=
'visible') {
2029 $this->SetVisibility(
'visible');
2034 if (!$this->tableOfContents->TOCmark) {
2035 $this->InFooter =
true;
2037 $this->InFooter =
false;
2040 if ($this->tableOfContents->TOCmark || count($this->tableOfContents->m_TOC)) {
2041 $this->tableOfContents->insertTOC();
2059 if (isset($pba[
'w'])) {
2062 if (isset($pba[
'h'])) {
2067 $ch = $ch * Mpdf::SCALE;
2068 if (empty($size) && !$resize) {
2069 return [$imw, $imh, $repx, $repy];
2072 if (isset($size[
'w']) && $size[
'w']) {
2073 if ($size[
'w'] ==
'contain') {
2077 $h = $imh *
$cw / $imw;
2083 } elseif ($size[
'w'] ==
'cover') {
2086 $h = $imh *
$cw / $imw;
2093 if (stristr($size[
'w'],
'%')) {
2094 $size[
'w'] = (float) $size[
'w'];
2096 $size[
'w'] = (
$cw * $size[
'w']);
2098 if (stristr($size[
'h'],
'%')) {
2099 $size[
'h'] = (float) $size[
'h'];
2101 $size[
'h'] = ($ch * $size[
'h']);
2103 if ($size[
'w'] ==
'auto' && $size[
'h'] ==
'auto') {
2106 } elseif ($size[
'w'] ==
'auto' && $size[
'h'] !=
'auto') {
2107 $w = $imw * $size[
'h'] / $imh;
2109 } elseif ($size[
'w'] !=
'auto' && $size[
'h'] ==
'auto') {
2110 $h = $imh * $size[
'w'] / $imw;
2117 return [$w, $h, $repx, $repy];
2118 } elseif ($resize == 1 && $imw >
$cw) {
2119 $h = $imh *
$cw / $imw;
2120 return [
$cw, $h, $repx, $repy];
2121 } elseif ($resize == 2 && $imh > $ch) {
2122 $w = $imw * $ch / $imh;
2123 return [$w, $ch, $repx, $repy];
2124 } elseif ($resize == 3) {
2135 return [$w, $h, $repx, $repy];
2136 } elseif ($resize == 4) {
2137 $h = $imh *
$cw / $imw;
2138 return [
$cw, $h, $repx, $repy];
2139 } elseif ($resize == 5) {
2140 $w = $imw * $ch / $imh;
2141 return [$w, $ch, $repx, $repy];
2142 } elseif ($resize == 6) {
2143 return [
$cw, $ch, $repx, $repy];
2145 return [$imw, $imh, $repx, $repy];
2150 if (isset($properties[
'BACKGROUND-ORIGIN']) && ($properties[
'BACKGROUND-ORIGIN'] ==
'border-box' || $properties[
'BACKGROUND-ORIGIN'] ==
'content-box')) {
2151 $origin = $properties[
'BACKGROUND-ORIGIN'];
2153 $origin =
'padding-box';
2156 if (isset($properties[
'BACKGROUND-SIZE'])) {
2157 if (stristr($properties[
'BACKGROUND-SIZE'],
'contain')) {
2158 $bsw = $bsh =
'contain';
2159 } elseif (stristr($properties[
'BACKGROUND-SIZE'],
'cover')) {
2160 $bsw = $bsh =
'cover';
2162 $bsw = $bsh =
'auto';
2163 $sz = preg_split(
'/\s+/', trim($properties[
'BACKGROUND-SIZE']));
2164 if (count($sz) == 2) {
2170 if (!stristr($bsw,
'%') && !stristr($bsw,
'auto')) {
2171 $bsw = $this->sizeConverter->convert($bsw, $maxwidth, $this->FontSize);
2173 if (!stristr($bsh,
'%') && !stristr($bsh,
'auto')) {
2174 $bsh = $this->sizeConverter->convert($bsh, $maxwidth, $this->FontSize);
2177 $size = [
'w' => $bsw,
'h' => $bsh];
2181 if (preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $properties[
'BACKGROUND-IMAGE'])) {
2182 return [
'gradient' => $properties[
'BACKGROUND-IMAGE'],
'origin' => $origin,
'size' => $size];
2184 $file = $properties[
'BACKGROUND-IMAGE'];
2185 $sizesarray = $this->Image($file, 0, 0, 0, 0,
'',
'',
false,
false,
false,
false,
true);
2186 if (isset($sizesarray[
'IMAGE_ID'])) {
2187 $image_id = $sizesarray[
'IMAGE_ID'];
2188 $orig_w = $sizesarray[
'WIDTH'] * Mpdf::SCALE;
2189 $orig_h = $sizesarray[
'HEIGHT'] * Mpdf::SCALE;
2190 if (isset($properties[
'BACKGROUND-IMAGE-RESOLUTION'])) {
2191 if (preg_match(
'/from-image/i', $properties[
'BACKGROUND-IMAGE-RESOLUTION']) && isset($sizesarray[
'set-dpi']) && $sizesarray[
'set-dpi'] > 0) {
2192 $orig_w *= $this->img_dpi / $sizesarray[
'set-dpi'];
2193 $orig_h *= $this->img_dpi / $sizesarray[
'set-dpi'];
2194 } elseif (preg_match(
'/(\d+)dpi/i', $properties[
'BACKGROUND-IMAGE-RESOLUTION'], $m)) {
2197 $orig_w *= $this->img_dpi / $dpi;
2198 $orig_h *= $this->img_dpi / $dpi;
2204 if (isset($properties[
'BACKGROUND-REPEAT'])) {
2205 if ($properties[
'BACKGROUND-REPEAT'] ==
'no-repeat' || $properties[
'BACKGROUND-REPEAT'] ==
'repeat-x') {
2208 if ($properties[
'BACKGROUND-REPEAT'] ==
'no-repeat' || $properties[
'BACKGROUND-REPEAT'] ==
'repeat-y') {
2214 if (isset($properties[
'BACKGROUND-POSITION'])) {
2215 $ppos = preg_split(
'/\s+/', $properties[
'BACKGROUND-POSITION']);
2218 if (!stristr($x_pos,
'%')) {
2219 $x_pos = $this->sizeConverter->convert($x_pos, $maxwidth, $this->FontSize);
2221 if (!stristr($y_pos,
'%')) {
2222 $y_pos = $this->sizeConverter->convert($y_pos, $maxwidth, $this->FontSize);
2225 if (isset($properties[
'BACKGROUND-IMAGE-RESIZE'])) {
2226 $resize = $properties[
'BACKGROUND-IMAGE-RESIZE'];
2230 if (isset($properties[
'BACKGROUND-IMAGE-OPACITY'])) {
2231 $opacity = $properties[
'BACKGROUND-IMAGE-OPACITY'];
2235 return [
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'resize' => $resize,
'opacity' => $opacity,
'itype' => $sizesarray[
'itype'],
'origin' => $origin,
'size' => $size];
2251 if ($this->pageDim[$this->page][
'outer_width_LR'] || $this->pageDim[$this->page][
'outer_width_TB']) {
2252 $clx = $this->pageDim[$this->page][
'outer_width_LR'] - $this->pageDim[$this->page][
'bleedMargin'];
2253 $cly = $this->pageDim[$this->page][
'outer_width_TB'] - $this->pageDim[$this->page][
'bleedMargin'];
2254 $clw = $this->w - 2 * $clx;
2255 $clh = $this->h - 2 * $cly;
2258 if ($this->bodyBackgroundColor) {
2259 $s .=
'q ' . $this->SetFColor($this->bodyBackgroundColor,
true) .
"\n";
2260 if ($this->bodyBackgroundColor[0] == 5) {
2261 $s .= $this->SetAlpha(ord($this->bodyBackgroundColor[4]) / 100,
'Normal',
true,
'F') .
"\n";
2262 } elseif ($this->bodyBackgroundColor[0] == 6) {
2263 $s .= $this->SetAlpha(ord($this->bodyBackgroundColor[5]) / 100,
'Normal',
true,
'F') .
"\n";
2265 $s .= sprintf(
'%.3F %.3F %.3F %.3F re f Q', ($clx * Mpdf::SCALE), ($cly * Mpdf::SCALE), $clw * Mpdf::SCALE, $clh * Mpdf::SCALE) .
"\n";
2269 if ($this->bodyBackgroundGradient) {
2270 $g = $this->gradient->parseBackgroundGradient($this->bodyBackgroundGradient);
2272 $s .= $this->gradient->Gradient($clx, $cly, $clw, $clh, (isset($g[
'gradtype']) ? $g[
'gradtype'] :
null), $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend'],
true);
2275 if ($this->bodyBackgroundImage) {
2276 if (isset($this->bodyBackgroundImage[
'gradient']) && $this->bodyBackgroundImage[
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $this->bodyBackgroundImage[
'gradient'])) {
2277 $g = $this->gradient->parseMozGradient($this->bodyBackgroundImage[
'gradient']);
2279 $s .= $this->gradient->Gradient($clx, $cly, $clw, $clh, $g[
'type'], $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend'],
true);
2281 } elseif ($this->bodyBackgroundImage[
'image_id']) {
2282 $n = count($this->patterns) + 1;
2284 list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($this->bodyBackgroundImage[
'orig_w'], $this->bodyBackgroundImage[
'orig_h'], $clw, $clh, $this->bodyBackgroundImage[
'resize'], $this->bodyBackgroundImage[
'x_repeat'], $this->bodyBackgroundImage[
'y_repeat']);
2286 $this->patterns[$n] = [
'x' => $clx,
'y' => $cly,
'w' => $clw,
'h' => $clh,
'pgh' => $this->h,
'image_id' => $this->bodyBackgroundImage[
'image_id'],
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $this->bodyBackgroundImage[
'x_pos'],
'y_pos' => $this->bodyBackgroundImage[
'y_pos'],
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'itype' => $this->bodyBackgroundImage[
'itype']];
2287 if (($this->bodyBackgroundImage[
'opacity'] > 0 || $this->bodyBackgroundImage[
'opacity'] ===
'0') && $this->bodyBackgroundImage[
'opacity'] < 1) {
2288 $opac = $this->SetAlpha($this->bodyBackgroundImage[
'opacity'],
'Normal',
true);
2292 $s .= sprintf(
'q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, ($clx * Mpdf::SCALE), ($cly * Mpdf::SCALE), $clw * Mpdf::SCALE, $clh * Mpdf::SCALE) .
"\n";
2302 $s .= sprintf(
'%.3F %.3F m ', ($clx) * Mpdf::SCALE, ($this->h - ($cly)) * Mpdf::SCALE);
2303 $s .= sprintf(
'%.3F %.3F l ', ($clx) * Mpdf::SCALE, ($this->h - ($cly + $clh)) * Mpdf::SCALE);
2304 $s .= sprintf(
'%.3F %.3F l ', ($clx + $clw) * Mpdf::SCALE, ($this->h - ($cly + $clh)) * Mpdf::SCALE);
2305 $s .= sprintf(
'%.3F %.3F l ', ($clx + $clw) * Mpdf::SCALE, ($this->h - ($cly)) * Mpdf::SCALE);
2306 $s .= sprintf(
'%.3F %.3F l ', ($clx) * Mpdf::SCALE, ($this->h - ($cly)) * Mpdf::SCALE);
2315 ksort($this->pageBackgrounds);
2317 foreach ($this->pageBackgrounds as $bl => $pbs) {
2319 foreach ($pbs as $pb) {
2321 if ((!isset($pb[
'image_id']) && !isset($pb[
'gradient'])) || isset($pb[
'shadowonly'])) {
2323 if ($pb[
'z-index'] > 0) {
2324 $this->current_layer = $pb[
'z-index'];
2325 $s .=
"\n" .
'/OCBZ-index /ZI' . $pb[
'z-index'] .
' BDC' .
"\n";
2328 if ($pb[
'visibility'] !=
'visible') {
2329 if ($pb[
'visibility'] ==
'printonly') {
2330 $s .=
'/OC /OC1 BDC' .
"\n";
2331 } elseif ($pb[
'visibility'] ==
'screenonly') {
2332 $s .=
'/OC /OC2 BDC' .
"\n";
2333 } elseif ($pb[
'visibility'] ==
'hidden') {
2334 $s .=
'/OC /OC3 BDC' .
"\n";
2339 if (isset($pb[
'shadow']) && $pb[
'shadow']) {
2340 $s .= $pb[
'shadow'] .
"\n";
2343 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2344 $s .= $pb[
'clippath'] .
"\n";
2347 $s .=
'q ' . $this->SetFColor($pb[
'col'],
true) .
"\n";
2349 if ($pb[
'col'] && $pb[
'col'][0] ===
'5') {
2350 $s .= $this->SetAlpha(ord($pb[
'col'][4]) / 100,
'Normal',
true,
'F') .
"\n";
2351 } elseif ($pb[
'col'] && $pb[
'col'][0] ===
'6') {
2352 $s .= $this->SetAlpha(ord($pb[
'col'][5]) / 100,
'Normal',
true,
'F') .
"\n";
2355 $s .= sprintf(
'%.3F %.3F %.3F %.3F re f Q', $pb[
'x'] * Mpdf::SCALE, ($this->h - $pb[
'y']) * Mpdf::SCALE, $pb[
'w'] * Mpdf::SCALE, -$pb[
'h'] * Mpdf::SCALE) .
"\n";
2357 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2361 if ($pb[
'visibility'] !=
'visible') {
2365 if ($pb[
'z-index'] > 0) {
2366 $s .=
"\n" .
'EMCBZ-index' .
"\n";
2367 $this->current_layer = 0;
2373 foreach ($pbs as $pb) {
2375 if ((isset($pb[
'gradient']) && $pb[
'gradient']) || (isset($pb[
'image_id']) && $pb[
'image_id'])) {
2377 if ($pb[
'z-index'] > 0) {
2378 $this->current_layer = $pb[
'z-index'];
2379 $s .=
"\n" .
'/OCGZ-index /ZI' . $pb[
'z-index'] .
' BDC' .
"\n";
2382 if ($pb[
'visibility'] !=
'visible') {
2383 if ($pb[
'visibility'] ==
'printonly') {
2384 $s .=
'/OC /OC1 BDC' .
"\n";
2385 } elseif ($pb[
'visibility'] ==
'screenonly') {
2386 $s .=
'/OC /OC2 BDC' .
"\n";
2387 } elseif ($pb[
'visibility'] ==
'hidden') {
2388 $s .=
'/OC /OC3 BDC' .
"\n";
2394 if (isset($pb[
'gradient']) && $pb[
'gradient']) {
2396 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2397 $s .= $pb[
'clippath'] .
"\n";
2400 $s .= $this->gradient->Gradient($pb[
'x'], $pb[
'y'], $pb[
'w'], $pb[
'h'], $pb[
'gradtype'], $pb[
'stops'], $pb[
'colorspace'], $pb[
'coords'], $pb[
'extend'],
true);
2402 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2406 } elseif (isset($pb[
'image_id']) && $pb[
'image_id']) {
2408 $pb[
'y'] -= $adjustmenty;
2409 $pb[
'h'] += $adjustmenty;
2410 $n = count($this->patterns) + 1;
2412 list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($pb[
'orig_w'], $pb[
'orig_h'], $pb[
'w'], $pb[
'h'], $pb[
'resize'], $pb[
'x_repeat'], $pb[
'y_repeat'], $pb[
'bpa'], $pb[
'size']);
2414 $this->patterns[$n] = [
'x' => $pb[
'x'],
'y' => $pb[
'y'],
'w' => $pb[
'w'],
'h' => $pb[
'h'],
'pgh' => $this->h,
'image_id' => $pb[
'image_id'],
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $pb[
'x_pos'],
'y_pos' => $pb[
'y_pos'],
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'itype' => $pb[
'itype'],
'bpa' => $pb[
'bpa']];
2416 $x = $pb[
'x'] * Mpdf::SCALE;
2417 $y = ($this->h - $pb[
'y']) * Mpdf::SCALE;
2418 $w = $pb[
'w'] * Mpdf::SCALE;
2419 $h = -$pb[
'h'] * Mpdf::SCALE;
2421 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2422 $s .= $pb[
'clippath'] .
"\n";
2425 if ($this->writingHTMLfooter || $this->writingHTMLheader) {
2427 $iw = $pb[
'orig_w'] / Mpdf::SCALE;
2428 $ih = $pb[
'orig_h'] / Mpdf::SCALE;
2435 if (isset($pb[
'bpa']) && $pb[
'bpa']) {
2436 $w = $pb[
'bpa'][
'w'];
2437 $h = $pb[
'bpa'][
'h'];
2438 $x0 = $pb[
'bpa'][
'x'];
2439 $y0 = $pb[
'bpa'][
'y'];
2442 if (isset($pb[
'size'][
'w']) && $pb[
'size'][
'w']) {
2443 $size = $pb[
'size'];
2445 if ($size[
'w'] ==
'contain') {
2449 $ih = $ih * $pb[
'bpa'][
'w'] / $iw;
2450 $iw = $pb[
'bpa'][
'w'];
2451 if ($ih > $pb[
'bpa'][
'h']) {
2452 $iw = $iw * $pb[
'bpa'][
'h'] / $ih;
2453 $ih = $pb[
'bpa'][
'h'];
2455 } elseif ($size[
'w'] ==
'cover') {
2458 $ih = $ih * $pb[
'bpa'][
'w'] / $iw;
2459 $iw = $pb[
'bpa'][
'w'];
2460 if ($ih < $pb[
'bpa'][
'h']) {
2461 $iw = $iw * $ih / $pb[
'bpa'][
'h'];
2462 $ih = $pb[
'bpa'][
'h'];
2469 $size[
'w'] = ($pb[
'bpa'][
'w'] * $size[
'w']);
2475 $size[
'h'] = ($pb[
'bpa'][
'h'] * $size[
'h']);
2478 if ($size[
'w'] ==
'auto' && $size[
'h'] ==
'auto') {
2481 } elseif ($size[
'w'] ==
'auto' && $size[
'h'] !=
'auto') {
2482 $iw = $iw * $size[
'h'] / $ih;
2484 } elseif ($size[
'w'] !=
'auto' && $size[
'h'] ==
'auto') {
2485 $ih = $ih * $size[
'w'] / $iw;
2495 if ($pb[
'x_repeat']) {
2496 $nx = ceil($pb[
'w'] / $iw) + 1;
2501 if ($pb[
'y_repeat']) {
2502 $ny = ceil($pb[
'h'] / $ih) + 1;
2507 $x_pos = $pb[
'x_pos'];
2508 if (stristr($x_pos,
'%')) {
2509 $x_pos = (float) $x_pos;
2511 $x_pos = ($pb[
'bpa'][
'w'] * $x_pos) - ($iw * $x_pos);
2514 $y_pos = $pb[
'y_pos'];
2516 if (stristr($y_pos,
'%')) {
2517 $y_pos = (float) $y_pos;
2519 $y_pos = ($pb[
'bpa'][
'h'] * $y_pos) - ($ih * $y_pos);
2523 while ($x_pos > ($pb[
'x'] - $pb[
'bpa'][
'x'])) {
2529 while ($y_pos > ($pb[
'y'] - $pb[
'bpa'][
'y'])) {
2534 for ($xi = 0; $xi < $nx; $xi++) {
2535 for ($yi = 0; $yi < $ny; $yi++) {
2536 $x = $x0 + $x_pos + ($iw * $xi);
2537 $y = $y0 + $y_pos + ($ih * $yi);
2538 if ($pb[
'opacity'] > 0 && $pb[
'opacity'] < 1) {
2539 $opac = $this->SetAlpha($pb[
'opacity'],
'Normal',
true);
2543 $s .= sprintf(
"q %s %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q", $opac, $iw * Mpdf::SCALE, $ih * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($y + $ih)) * Mpdf::SCALE, $pb[
'image_id']) .
"\n";
2548 if (($pb[
'opacity'] > 0 || $pb[
'opacity'] ===
'0') && $pb[
'opacity'] < 1) {
2549 $opac = $this->SetAlpha($pb[
'opacity'],
'Normal',
true);
2553 $s .= sprintf(
'q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, $x, $y, $w, $h) .
"\n";
2556 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2561 if ((isset($pb[
'gradient']) && $pb[
'gradient']) || (isset($pb[
'image_id']) && $pb[
'image_id'])) {
2562 if ($pb[
'visibility'] !=
'visible') {
2566 if ($pb[
'z-index'] > 0) {
2567 $s .=
"\n" .
'EMCGZ-index' .
"\n";
2568 $this->current_layer = 0;
2582 ksort($this->tableBackgrounds);
2583 foreach ($this->tableBackgrounds as $bl => $pbs) {
2584 foreach ($pbs as $pb) {
2585 if ((!isset($pb[
'gradient']) || !$pb[
'gradient']) && (!isset($pb[
'image_id']) || !$pb[
'image_id'])) {
2586 $s .=
'q ' . $this->SetFColor($pb[
'col'],
true) .
"\n";
2587 if ($pb[
'col'][0] == 5) {
2588 $s .= $this->SetAlpha(ord($pb[
'col'][4]) / 100,
'Normal',
true,
'F') .
"\n";
2589 } elseif ($pb[
'col'][0] == 6) {
2590 $s .= $this->SetAlpha(ord($pb[
'col'][5]) / 100,
'Normal',
true,
'F') .
"\n";
2592 $s .= sprintf(
'%.3F %.3F %.3F %.3F re %s Q', $pb[
'x'] * Mpdf::SCALE, ($this->h - $pb[
'y']) * Mpdf::SCALE, $pb[
'w'] * Mpdf::SCALE, -$pb[
'h'] * Mpdf::SCALE,
'f') .
"\n";
2594 if (isset($pb[
'gradient']) && $pb[
'gradient']) {
2595 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2596 $s .= $pb[
'clippath'] .
"\n";
2598 $s .= $this->gradient->Gradient($pb[
'x'], $pb[
'y'], $pb[
'w'], $pb[
'h'], $pb[
'gradtype'], $pb[
'stops'], $pb[
'colorspace'], $pb[
'coords'], $pb[
'extend'],
true);
2599 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2603 if (isset($pb[
'image_id']) && $pb[
'image_id']) {
2604 $pb[
'y'] -= $adjustmenty;
2605 $pb[
'h'] += $adjustmenty;
2606 $n = count($this->patterns) + 1;
2607 list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($pb[
'orig_w'], $pb[
'orig_h'], $pb[
'w'], $pb[
'h'], $pb[
'resize'], $pb[
'x_repeat'], $pb[
'y_repeat']);
2608 $this->patterns[$n] = [
'x' => $pb[
'x'],
'y' => $pb[
'y'],
'w' => $pb[
'w'],
'h' => $pb[
'h'],
'pgh' => $this->h,
'image_id' => $pb[
'image_id'],
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $pb[
'x_pos'],
'y_pos' => $pb[
'y_pos'],
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'itype' => $pb[
'itype']];
2609 $x = $pb[
'x'] * Mpdf::SCALE;
2610 $y = ($this->h - $pb[
'y']) * Mpdf::SCALE;
2611 $w = $pb[
'w'] * Mpdf::SCALE;
2612 $h = -$pb[
'h'] * Mpdf::SCALE;
2615 if (($this->writingHTMLfooter || $this->writingHTMLheader) && (!isset($pb[
'clippath']) || $pb[
'clippath'] ==
'')) {
2617 $pb[
'clippath'] = sprintf(
' q 0 w %.3F %.3F m %.3F %.3F l %.3F %.3F l %.3F %.3F l %.3F %.3F l W n ', $x, $y, $x, $y + $h, $x + $w, $y + $h, $x + $w, $y, $x, $y);
2620 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2621 $s .= $pb[
'clippath'] .
"\n";
2625 if ($this->writingHTMLfooter || $this->writingHTMLheader) {
2626 $iw = $pb[
'orig_w'] / Mpdf::SCALE;
2627 $ih = $pb[
'orig_h'] / Mpdf::SCALE;
2634 if (isset($pb[
'bpa']) && $pb[
'bpa']) {
2635 $w = $pb[
'bpa'][
'w'];
2636 $h = $pb[
'bpa'][
'h'];
2637 $x0 = $pb[
'bpa'][
'x'];
2638 $y0 = $pb[
'bpa'][
'y'];
2642 $pb[
'bpa'] = [
'x' => $x0,
'y' => $y0,
'w' => $w,
'h' => $h];
2645 if (isset($pb[
'size'][
'w']) && $pb[
'size'][
'w']) {
2646 $size = $pb[
'size'];
2648 if ($size[
'w'] ==
'contain') {
2651 $ih = $ih * $pb[
'bpa'][
'w'] / $iw;
2652 $iw = $pb[
'bpa'][
'w'];
2653 if ($ih > $pb[
'bpa'][
'h']) {
2654 $iw = $iw * $pb[
'bpa'][
'h'] / $ih;
2655 $ih = $pb[
'bpa'][
'h'];
2657 } elseif ($size[
'w'] ==
'cover') {
2659 $ih = $ih * $pb[
'bpa'][
'w'] / $iw;
2660 $iw = $pb[
'bpa'][
'w'];
2661 if ($ih < $pb[
'bpa'][
'h']) {
2662 $iw = $iw * $ih / $pb[
'bpa'][
'h'];
2663 $ih = $pb[
'bpa'][
'h'];
2669 $size[
'w'] = ($pb[
'bpa'][
'w'] * $size[
'w']);
2674 $size[
'h'] = ($pb[
'bpa'][
'h'] * $size[
'h']);
2676 if ($size[
'w'] ==
'auto' && $size[
'h'] ==
'auto') {
2679 } elseif ($size[
'w'] ==
'auto' && $size[
'h'] !=
'auto') {
2680 $iw = $iw * $size[
'h'] / $ih;
2682 } elseif ($size[
'w'] !=
'auto' && $size[
'h'] ==
'auto') {
2683 $ih = $ih * $size[
'w'] / $iw;
2693 if (isset($pb[
'x_repeat']) && $pb[
'x_repeat']) {
2694 $nx = ceil($pb[
'w'] / $iw) + 1;
2698 if (isset($pb[
'y_repeat']) && $pb[
'y_repeat']) {
2699 $ny = ceil($pb[
'h'] / $ih) + 1;
2704 $x_pos = $pb[
'x_pos'];
2708 $x_pos = ($pb[
'bpa'][
'w'] * $x_pos) - ($iw * $x_pos);
2710 $y_pos = $pb[
'y_pos'];
2714 $y_pos = ($pb[
'bpa'][
'h'] * $y_pos) - ($ih * $y_pos);
2717 while ($x_pos > ($pb[
'x'] - $pb[
'bpa'][
'x'])) {
2722 while ($y_pos > ($pb[
'y'] - $pb[
'bpa'][
'y'])) {
2726 for ($xi = 0; $xi < $nx; $xi++) {
2727 for ($yi = 0; $yi < $ny; $yi++) {
2728 $x = $x0 + $x_pos + ($iw * $xi);
2729 $y = $y0 + $y_pos + ($ih * $yi);
2730 if ($pb[
'opacity'] > 0 && $pb[
'opacity'] < 1) {
2731 $opac = $this->SetAlpha($pb[
'opacity'],
'Normal',
true);
2735 $s .= sprintf(
"q %s %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q", $opac, $iw * Mpdf::SCALE, $ih * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($y + $ih)) * Mpdf::SCALE, $pb[
'image_id']) .
"\n";
2739 if (($pb[
'opacity'] > 0 || $pb[
'opacity'] ===
'0') && $pb[
'opacity'] < 1) {
2740 $opac = $this->SetAlpha($pb[
'opacity'],
'Normal',
true);
2744 $s .= sprintf(
'q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, $x, $y, $w, $h) .
"\n";
2747 if (isset($pb[
'clippath']) && $pb[
'clippath']) {
2759 if ($this->current_layer > 0) {
2765 if (!isset($this->layers[
$id])) {
2766 $this->layers[
$id] = [
'name' =>
'Layer ' . (
$id)];
2767 if (($this->PDFA || $this->PDFX)) {
2768 $this->PDFAXwarnings[] =
"Cannot use layers when using PDFA or PDFX";
2770 } elseif (!$this->PDFA && !$this->PDFX) {
2771 $this->pdf_version =
'1.5';
2774 $this->current_layer =
$id;
2775 $this->writer->write(
'/OCZ-index /ZI' .
$id .
' BDC');
2777 $this->pageoutput[$this->page] = [];
2782 if ($this->current_layer > 0) {
2783 $this->writer->write(
'EMCZ-index');
2784 $this->current_layer = 0;
2790 if (!is_array($a)) {
2794 $orientation = (isset($a[
'orientation']) ? $a[
'orientation'] :
'');
2795 $condition = (isset($a[
'condition']) ? $a[
'condition'] : (isset($a[
'type']) ? $a[
'type'] :
''));
2796 $resetpagenum = (isset($a[
'resetpagenum']) ? $a[
'resetpagenum'] :
'');
2797 $pagenumstyle = (isset($a[
'pagenumstyle']) ? $a[
'pagenumstyle'] :
'');
2798 $suppress = (isset($a[
'suppress']) ? $a[
'suppress'] :
'');
2799 $mgl = (isset($a[
'mgl']) ? $a[
'mgl'] : (isset($a[
'margin-left']) ? $a[
'margin-left'] :
''));
2800 $mgr = (isset($a[
'mgr']) ? $a[
'mgr'] : (isset($a[
'margin-right']) ? $a[
'margin-right'] :
''));
2801 $mgt = (isset($a[
'mgt']) ? $a[
'mgt'] : (isset($a[
'margin-top']) ? $a[
'margin-top'] :
''));
2802 $mgb = (isset($a[
'mgb']) ? $a[
'mgb'] : (isset($a[
'margin-bottom']) ? $a[
'margin-bottom'] :
''));
2803 $mgh = (isset($a[
'mgh']) ? $a[
'mgh'] : (isset($a[
'margin-header']) ? $a[
'margin-header'] :
''));
2804 $mgf = (isset($a[
'mgf']) ? $a[
'mgf'] : (isset($a[
'margin-footer']) ? $a[
'margin-footer'] :
''));
2805 $ohname = (isset($a[
'ohname']) ? $a[
'ohname'] : (isset($a[
'odd-header-name']) ? $a[
'odd-header-name'] :
''));
2806 $ehname = (isset($a[
'ehname']) ? $a[
'ehname'] : (isset($a[
'even-header-name']) ? $a[
'even-header-name'] :
''));
2807 $ofname = (isset($a[
'ofname']) ? $a[
'ofname'] : (isset($a[
'odd-footer-name']) ? $a[
'odd-footer-name'] :
''));
2808 $efname = (isset($a[
'efname']) ? $a[
'efname'] : (isset($a[
'even-footer-name']) ? $a[
'even-footer-name'] :
''));
2809 $ohvalue = (isset($a[
'ohvalue']) ? $a[
'ohvalue'] : (isset($a[
'odd-header-value']) ? $a[
'odd-header-value'] : 0));
2810 $ehvalue = (isset($a[
'ehvalue']) ? $a[
'ehvalue'] : (isset($a[
'even-header-value']) ? $a[
'even-header-value'] : 0));
2811 $ofvalue = (isset($a[
'ofvalue']) ? $a[
'ofvalue'] : (isset($a[
'odd-footer-value']) ? $a[
'odd-footer-value'] : 0));
2812 $efvalue = (isset($a[
'efvalue']) ? $a[
'efvalue'] : (isset($a[
'even-footer-value']) ? $a[
'even-footer-value'] : 0));
2813 $pagesel = (isset($a[
'pagesel']) ? $a[
'pagesel'] : (isset($a[
'pageselector']) ? $a[
'pageselector'] :
''));
2814 $newformat = (isset($a[
'newformat']) ? $a[
'newformat'] : (isset($a[
'sheet-size']) ? $a[
'sheet-size'] :
''));
2816 $this->
AddPage($orientation, $condition, $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
2822 if ($pagebreaktype ==
'cloneall') {
2826 for ($b = $this->blklvl; $b > 0; $b--) {
2827 $this->tag->CloseTag($this->blk[$b][
'tag'], $arr, $ai);
2829 if ($this->blklvl == 0 && !empty($this->textbuffer)) {
2830 $this->printbuffer($this->textbuffer, 1);
2831 $this->textbuffer = [];
2833 } elseif ($pagebreaktype ==
'clonebycss') {
2837 for ($b = $this->blklvl; $b > 0; $b--) {
2838 if (isset($this->blk[$b][
'box_decoration_break']) && $this->blk[$b][
'box_decoration_break'] ==
'clone') {
2839 $this->tag->CloseTag($this->blk[$b][
'tag'], $arr, $ai);
2841 if ($b == $this->blklvl && !empty($this->textbuffer)) {
2842 $this->printbuffer($this->textbuffer, 1);
2843 $this->textbuffer = [];
2848 } elseif (!empty($this->textbuffer)) {
2849 $this->printbuffer($this->textbuffer, 1);
2850 $this->textbuffer = [];
2857 if ($pagebreaktype ==
'cloneall') {
2859 $this->blk[0] = $save_blk[0];
2864 for ($b = 1; $b <= $save_blklvl; $b++) {
2865 $this->tag->OpenTag($save_blk[$b][
'tag'], $save_blk[$b][
'attr'], $arr, $i);
2867 } elseif ($pagebreaktype ==
'clonebycss') {
2869 $this->blk[0] = $save_blk[0];
2871 for ($b = 1; $b <= $this->blklvl; $b++) {
2872 $this->blk[$b] = $save_blk[$b];
2873 $this->blk[$b][
'startpage'] = 0;
2874 $this->blk[$b][
'y0'] = $this->y;
2875 if (($this->page - $startpage) % 2) {
2876 if (isset($this->blk[$b][
'x0'])) {
2877 $this->blk[$b][
'x0'] += $this->MarginCorrection;
2879 $this->blk[$b][
'x0'] = $this->MarginCorrection;
2883 $this->blk[$b][
'marginCorrected'][$this->page] =
true;
2889 for ($b = $this->blklvl + 1; $b <= $save_blklvl; $b++) {
2890 if ($b < $this->blklvl) {
2891 $this->lastblocklevelchange = -1;
2893 $this->tag->OpenTag($save_blk[$b][
'tag'], $save_blk[$b][
'attr'], $arr, $i);
2895 if ($this->blk[$this->blklvl][
'box_decoration_break'] !=
'clone') {
2896 $this->lastblocklevelchange = -1;
2899 $this->lastblocklevelchange = -1;
2930 if ($this->state > 0 && $this->page < count($this->pages)) {
2931 $bak_cml = $this->cMarginL;
2932 $bak_cmr = $this->cMarginR;
2933 $bak_dw = $this->divwidth;
2935 if ($this->blklvl > 0) {
2936 $save_tr = $this->table_rotate;
2937 $this->table_rotate = 0;
2938 if (isset($this->blk[$this->blklvl][
'y0']) && $this->y == $this->blk[$this->blklvl][
'y0']) {
2939 $this->blk[$this->blklvl][
'startpage'] ++;
2941 if ((isset($this->blk[$this->blklvl][
'y0']) && $this->y > $this->blk[$this->blklvl][
'y0']) || $this->flowingBlockAttr[
'is_table']) {
2942 $toplvl = $this->blklvl;
2944 $toplvl = $this->blklvl - 1;
2947 for ($bl = 1; $bl <= $toplvl; $bl++) {
2948 $this->PaintDivBB(
'pagebottom', 0, $bl);
2951 $this->table_rotate = $save_tr;
2953 $s = $this->PrintPageBackgrounds();
2956 $this->pages[$this->page] = preg_replace(
2957 '/(___BACKGROUND___PATTERNS' . $this->uniqstr .
')/',
2958 '\\1' .
"\n" . $s .
"\n",
2959 $this->pages[$this->page]
2962 $this->pageBackgrounds = [];
2963 $family = $this->FontFamily;
2964 $style = $this->FontStyle;
2965 $size = $this->FontSizePt;
2966 $lw = $this->LineWidth;
2967 $dc = $this->DrawColor;
2968 $fc = $this->FillColor;
2969 $tc = $this->TextColor;
2970 $cf = $this->ColorFlag;
2972 $this->printfloatbuffer();
2977 $this->ResetMargins();
2978 $this->SetAutoPageBreak($this->autoPageBreak, $this->bMargin);
2979 $this->x = $this->lMargin;
2980 $this->y = $this->tMargin;
2981 $this->FontFamily =
'';
2982 $this->writer->write(
'2 J');
2983 $this->LineWidth = $lw;
2984 $this->writer->write(sprintf(
'%.3F w', $lw * Mpdf::SCALE));
2987 $this->
SetFont($family, $style, $size,
true,
true);
2990 $this->DrawColor = $dc;
2992 if ($dc != $this->defDrawColor) {
2993 $this->writer->write($dc);
2996 $this->FillColor = $fc;
2998 if ($fc != $this->defFillColor) {
2999 $this->writer->write($fc);
3002 $this->TextColor = $tc;
3003 $this->ColorFlag = $cf;
3005 for ($bl = 1; $bl <= $this->blklvl; $bl++) {
3006 $this->blk[$bl][
'y0'] = $this->y;
3008 if (!isset($this->blk[$bl][
'marginCorrected'][$this->page])) {
3009 if (isset($this->blk[$bl][
'x0'])) {
3010 $this->blk[$bl][
'x0'] += $this->MarginCorrection;
3012 $this->blk[$bl][
'x0'] = $this->MarginCorrection;
3015 $this->blk[$bl][
'marginCorrected'][$this->page] =
true;
3018 $this->cMarginL = $bak_cml;
3019 $this->cMarginR = $bak_cmr;
3020 $this->divwidth = $bak_dw;
3027 if ($this->state == 0) {
3031 $bak_cml = $this->cMarginL;
3032 $bak_cmr = $this->cMarginR;
3033 $bak_dw = $this->divwidth;
3035 $bak_lh = $this->lineheight;
3037 $orientation = substr(strtoupper($orientation), 0, 1);
3038 $condition = strtoupper($condition);
3041 if ($condition ==
'E') {
3042 if (!$this->mirrorMargins || ($this->page) % 2 == 0) {
3045 } elseif ($condition ==
'O') {
3046 if (!$this->mirrorMargins || ($this->page) % 2 == 1) {
3049 } elseif ($condition ==
'NEXT-EVEN') {
3050 if (!$this->mirrorMargins) {
3060 $this->
AddPage($this->CurOrientation,
'O');
3061 $this->extrapagebreak =
true;
3067 } elseif ($condition ==
'NEXT-ODD') {
3068 if (!$this->mirrorMargins) {
3078 $this->
AddPage($this->CurOrientation,
'E');
3079 $this->extrapagebreak =
true;
3087 if ($resetpagenum || $pagenumstyle || $suppress) {
3088 $this->PageNumSubstitutions[] = [
'from' => ($this->page + 1),
'reset' => $resetpagenum,
'type' => $pagenumstyle,
'suppress' => $suppress];
3091 $save_tr = $this->table_rotate;
3092 $this->table_rotate = 0;
3093 $save_kwt = $this->kwt;
3095 $save_layer = $this->current_layer;
3096 $save_vis = $this->visibility;
3098 if ($this->visibility !=
'visible') {
3099 $this->SetVisibility(
'visible');
3106 if (!$this->ColActive && $this->blklvl > 0) {
3107 if (isset($this->blk[$this->blklvl][
'y0']) && $this->y == $this->blk[$this->blklvl][
'y0'] && !$this->extrapagebreak) {
3108 if (isset($this->blk[$this->blklvl][
'startpage'])) {
3109 $this->blk[$this->blklvl][
'startpage'] ++;
3111 $this->blk[$this->blklvl][
'startpage'] = 1;
3114 if ((isset($this->blk[$this->blklvl][
'y0']) && $this->y > $this->blk[$this->blklvl][
'y0']) || $this->flowingBlockAttr[
'is_table'] || $this->extrapagebreak) {
3115 $toplvl = $this->blklvl;
3118 $toplvl = $this->blklvl - 1;
3121 for ($bl = 1; $bl <= $toplvl; $bl++) {
3122 if (isset($this->blk[$bl][
'z-index']) && $this->blk[$bl][
'z-index'] > 0) {
3123 $this->BeginLayer($this->blk[$bl][
'z-index']);
3125 if (isset($this->blk[$bl][
'visibility']) && $this->blk[$bl][
'visibility'] && $this->blk[$bl][
'visibility'] !=
'visible') {
3126 $this->SetVisibility($this->blk[$bl][
'visibility']);
3128 $this->PaintDivBB(
'pagebottom', 0, $bl);
3133 $this->extrapagebreak =
false;
3135 if ($this->visibility !=
'visible') {
3136 $this->SetVisibility(
'visible');
3142 if ($this->page > 0) {
3144 $s .= $this->PrintBodyBackgrounds();
3146 $s .= $this->PrintPageBackgrounds();
3147 $this->pages[$this->page] = preg_replace(
'/(___BACKGROUND___PATTERNS' . $this->uniqstr .
')/',
"\n" . $s .
"\n" .
'\\1', $this->pages[$this->page]);
3148 $this->pageBackgrounds = [];
3151 $save_kt = $this->keep_block_together;
3152 $this->keep_block_together = 0;
3157 if ($this->ColActive) {
3159 $save_nbcol = $this->NbCol;
3160 $this->SetColumns(0);
3164 $family = $this->FontFamily;
3165 $style = $this->FontStyle;
3166 $size = $this->FontSizePt;
3167 $this->ColumnAdjust =
true;
3168 $lw = $this->LineWidth;
3169 $dc = $this->DrawColor;
3170 $fc = $this->FillColor;
3171 $tc = $this->TextColor;
3172 $cf = $this->ColorFlag;
3173 if ($this->page > 0) {
3175 $this->InFooter =
true;
3178 $this->pageoutput[$this->page] = [];
3186 $pageBeforeNewPage = $this->page;
3187 $this->_beginpage($orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $newformat);
3188 $isNewPage = $pageBeforeNewPage !== $this->page;
3190 if ($this->docTemplate) {
3194 if (($this->page - $this->docTemplateStart) > $pagecount) {
3195 if ($this->docTemplateContinue) {
3196 if ($this->docTemplateContinue2pages && $pagecount >= 2 && (0 === $this->page % 2)) {
3197 $tplIdx = $this->
importPage(($pagecount - 1));
3205 $tplIdx = $this->
importPage(($this->page - $this->docTemplateStart));
3212 if ($this->pageTemplate) {
3219 $this->writer->write(
'___PAGE___START' . $this->uniqstr);
3220 $this->writer->write(
'___BACKGROUND___PATTERNS' . $this->uniqstr);
3221 $this->writer->write(
'___HEADER___MARKER' . $this->uniqstr);
3224 $this->pageBackgrounds = [];
3227 $this->SetLineCap(2);
3229 $this->LineWidth = $lw;
3230 $this->writer->write(sprintf(
'%.3F w', $lw * Mpdf::SCALE));
3233 $this->
SetFont($family, $style, $size,
true,
true);
3237 $this->DrawColor = $dc;
3238 if ($dc != $this->defDrawColor) {
3239 $this->writer->write($dc);
3241 $this->FillColor = $fc;
3242 if ($fc != $this->defFillColor) {
3243 $this->writer->write($fc);
3245 $this->TextColor = $tc;
3246 $this->ColorFlag = $cf;
3252 if ($this->LineWidth != $lw) {
3253 $this->LineWidth = $lw;
3254 $this->writer->write(sprintf(
'%.3F w', $lw * Mpdf::SCALE));
3258 $this->
SetFont($family, $style, $size,
true,
true);
3262 if ($this->DrawColor != $dc) {
3263 $this->DrawColor = $dc;
3264 $this->writer->write($dc);
3266 if ($this->FillColor != $fc) {
3267 $this->FillColor = $fc;
3268 $this->writer->write($fc);
3270 $this->TextColor = $tc;
3271 $this->ColorFlag = $cf;
3272 $this->InFooter =
false;
3274 if ($save_layer > 0) {
3275 $this->BeginLayer($save_layer);
3278 if ($save_vis !=
'visible') {
3279 $this->SetVisibility($save_vis);
3285 $this->SetColumns($save_nbcol, $this->colvAlign, $this->ColGap);
3287 if ($this->ColActive) {
3294 if (!$this->ColActive) {
3295 for ($bl = 1; $bl <= $this->blklvl; $bl++) {
3296 $this->blk[$bl][
'y0'] = $this->y;
3297 if (isset($this->blk[$bl][
'x0'])) {
3298 $this->blk[$bl][
'x0'] += $this->MarginCorrection;
3300 $this->blk[$bl][
'x0'] = $this->MarginCorrection;
3303 $this->blk[$bl][
'marginCorrected'][$this->page] =
true;
3308 $this->table_rotate = $save_tr;
3309 $this->kwt = $save_kwt;
3311 $this->keep_block_together = $save_kt;
3313 $this->cMarginL = $bak_cml;
3314 $this->cMarginR = $bak_cmr;
3315 $this->divwidth = $bak_dw;
3317 $this->lineheight = $bak_lh;
3332 $colors = @file($file);
3334 throw new \Mpdf\MpdfException(
"Cannot load spot colors file - " . $file);
3336 foreach ($colors as $sc) {
3337 list(
$name, $c, $m, $y, $k) = preg_split(
"/\t/", $sc);
3342 $this->AddSpotColor(
$name, $c, $m, $y, $k);
3349 if (!isset($this->spotColors[
$name])) {
3350 $i = count($this->spotColors) + 1;
3351 $this->spotColors[
$name] = [
'i' => $i,
'c' => $c,
'm' => $m,
'y' => $y,
'k' => $k];
3352 $this->spotColorIDs[$i] =
$name;
3362 if ($col[0] == 3 || $col[0] == 5) {
3363 $out = sprintf(
'%.3F %.3F %.3F rg', ord($col[1]) / 255, ord($col[2]) / 255, ord($col[3]) / 255);
3364 } elseif ($col[0] == 1) {
3365 $out = sprintf(
'%.3F g', ord($col[1]) / 255);
3366 } elseif ($col[0] == 2) {
3367 $out = sprintf(
'/CS%d cs %.3F scn', ord($col[1]), ord($col[2]) / 100);
3368 } elseif ($col[0] == 4 || $col[0] == 6) {
3369 $out = sprintf(
'%.3F %.3F %.3F %.3F k', ord($col[1]) / 100, ord($col[2]) / 100, ord($col[3]) / 100, ord($col[4]) / 100);
3371 if ($type ==
'Draw') {
3372 $out = strtoupper($out);
3374 elseif ($type ==
'CodeOnly') {
3375 $out = preg_replace(
'/\s(rg|g|k)/',
'', $out);
3382 $out = $this->SetColor($col,
'Draw');
3389 $this->DrawColor = $out;
3390 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'DrawColor']) && $this->pageoutput[$this->page][
'DrawColor'] != $this->DrawColor) || !isset($this->pageoutput[$this->page][
'DrawColor']))) {
3391 $this->writer->write($this->DrawColor);
3393 $this->pageoutput[$this->page][
'DrawColor'] = $this->DrawColor;
3398 $out = $this->SetColor($col,
'Fill');
3405 $this->FillColor = $out;
3406 $this->ColorFlag = ($out != $this->TextColor);
3407 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'FillColor']) && $this->pageoutput[$this->page][
'FillColor'] != $this->FillColor) || !isset($this->pageoutput[$this->page][
'FillColor']))) {
3408 $this->writer->write($this->FillColor);
3410 $this->pageoutput[$this->page][
'FillColor'] = $this->FillColor;
3415 $out = $this->SetColor($col,
'Text');
3422 $this->TextColor = $out;
3423 $this->ColorFlag = ($this->FillColor != $out);
3430 if (($r == 0 and $g == 0 and $b == 0 && $col4 == -1) or $g == -1) {
3431 $col = $this->colorConverter->convert($r, $this->PDFAXwarnings);
3432 } elseif ($col4 == -1) {
3433 $col = $this->colorConverter->convert(
'rgb(' . $r .
',' . $g .
',' . $b .
')', $this->PDFAXwarnings);
3435 $col = $this->colorConverter->convert(
'cmyk(' . $r .
',' . $g .
',' . $b .
',' . $col4 .
')', $this->PDFAXwarnings);
3437 $out = $this->SetDColor($col, $return);
3445 if (($r == 0 and $g == 0 and $b == 0 && $col4 == -1) or $g == -1) {
3446 $col = $this->colorConverter->convert($r, $this->PDFAXwarnings);
3447 } elseif ($col4 == -1) {
3448 $col = $this->colorConverter->convert(
'rgb(' . $r .
',' . $g .
',' . $b .
')', $this->PDFAXwarnings);
3450 $col = $this->colorConverter->convert(
'cmyk(' . $r .
',' . $g .
',' . $b .
',' . $col4 .
')', $this->PDFAXwarnings);
3452 $out = $this->SetFColor($col, $return);
3460 if (($r == 0 and $g == 0 and $b == 0 && $col4 == -1) or $g == -1) {
3461 $col = $this->colorConverter->convert($r, $this->PDFAXwarnings);
3462 } elseif ($col4 == -1) {
3463 $col = $this->colorConverter->convert(
'rgb(' . $r .
',' . $g .
',' . $b .
')', $this->PDFAXwarnings);
3465 $col = $this->colorConverter->convert(
'cmyk(' . $r .
',' . $g .
',' . $b .
',' . $col4 .
')', $this->PDFAXwarnings);
3467 $out = $this->SetTColor($col, $return);
3477 } elseif (isset(
$cw[$u * 2 + 1])) {
3478 $w = (ord(
$cw[$u * 2]) << 8) + ord(
$cw[$u * 2 + 1]);
3498 if (isset(
$cw[$u * 2 + 1])) {
3499 $w = (ord(
$cw[$u * 2]) << 8) + ord(
$cw[$u * 2 + 1]);
3511 if ($c == chr(173) && $this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats') {
3514 $charw = $this->CurrentFont[
'cw'][chr($this->upperCase[ord($c)])];
3515 if ($charw !==
false) {
3516 $charw = $charw * $this->smCapsScale * $this->smCapsStretch / 100;
3519 } elseif (isset($this->CurrentFont[
'cw'][$c])) {
3520 $w += $this->CurrentFont[
'cw'][$c];
3521 } elseif (isset($this->CurrentFont[
'cw'][ord($c)])) {
3522 $w += $this->CurrentFont[
'cw'][ord($c)];
3524 $w *= ($this->FontSize / 1000);
3525 if ($this->minwSpacing || $this->fixedlSpacing) {
3531 $w += $this->fixedlSpacing + ($nb_spaces * $this->minwSpacing);
3541 $unicode = $this->UTF8StringToArray($c, $addSubset);
3542 $char = $unicode[0];
3544 if ($this->CurrentFont[
'type'] ==
'Type0') {
3548 elseif (isset($this->CurrentFont[
'cw'][$char])) {
3549 $w+=$this->CurrentFont[
'cw'][$char];
3550 } elseif (isset($this->CurrentFont[
'MissingWidth'])) {
3551 $w += $this->CurrentFont[
'MissingWidth'];
3561 $charw = $this->_getCharWidth($this->CurrentFont[
'cw'], $this->upperCase[$char]);
3562 if ($charw !==
false) {
3563 $charw = $charw * $this->smCapsScale * $this->smCapsStretch / 100;
3565 } elseif (isset($this->CurrentFont[
'desc'][
'MissingWidth'])) {
3566 $w += $this->CurrentFont[
'desc'][
'MissingWidth'];
3567 } elseif (isset($this->CurrentFont[
'MissingWidth'])) {
3568 $w += $this->CurrentFont[
'MissingWidth'];
3573 $charw = $this->_getCharWidth($this->CurrentFont[
'cw'], $char);
3574 if ($charw !==
false) {
3576 } elseif (isset($this->CurrentFont[
'desc'][
'MissingWidth'])) {
3577 $w += $this->CurrentFont[
'desc'][
'MissingWidth'];
3578 } elseif (isset($this->CurrentFont[
'MissingWidth'])) {
3579 $w += $this->CurrentFont[
'MissingWidth'];
3585 $w *= ($this->FontSize / 1000);
3586 if ($this->minwSpacing || $this->fixedlSpacing) {
3592 $w += $this->fixedlSpacing + ($nb_spaces * $this->minwSpacing);
3599 if (!$this->usingCoreFont) {
3600 return $this->GetCharWidthNonCore($c, $addSubset);
3602 return $this->GetCharWidthCore($c);
3606 function GetStringWidth($s, $addSubset =
true, $OTLdata =
false, $textvar = 0, $includeKashida =
false)
3611 $cw = &$this->CurrentFont[
'cw'];
3619 if ($this->iterationCounter) {
3620 $s = preg_replace(
'/{iteration ([a-zA-Z0-9_]+)}/',
'\\1', $s);
3622 if (!$this->usingCoreFont) {
3623 $discards = substr_count($s,
"\xc2\xad");
3624 $unicode = $this->UTF8StringToArray($s, $addSubset);
3625 if ($this->minwSpacing || $this->fixedlSpacing) {
3626 $nb_spaces = mb_substr_count($s,
' ', $this->mb_enc);
3627 $nb_carac = count($unicode) - $discards;
3630 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
3631 if (isset($OTLdata[
'group']) && $OTLdata[
'group']) {
3632 $nb_carac -= substr_count($OTLdata[
'group'],
'M');
3637 if ($this->CurrentFont[
'type'] ==
'Type0') {
3638 foreach ($unicode as $char) {
3639 if ($char == 0x00AD) {
3642 if (isset(
$cw[$char])) {
3644 } elseif (isset($this->CurrentFont[
'MissingWidth'])) {
3645 $w += $this->CurrentFont[
'MissingWidth'];
3652 foreach ($unicode as $i => $char) {
3653 if ($char == 0x00AD) {
3657 $charw = $this->_getCharWidth(
$cw, $this->upperCase[$char]);
3658 if ($charw !==
false) {
3659 $charw = $charw * $this->smCapsScale * $this->smCapsStretch / 100;
3661 } elseif (isset($this->CurrentFont[
'desc'][
'MissingWidth'])) {
3662 $w += $this->CurrentFont[
'desc'][
'MissingWidth'];
3663 } elseif (isset($this->CurrentFont[
'MissingWidth'])) {
3664 $w += $this->CurrentFont[
'MissingWidth'];
3669 $charw = $this->_getCharWidth(
$cw, $char);
3670 if ($charw !==
false) {
3672 } elseif (isset($this->CurrentFont[
'desc'][
'MissingWidth'])) {
3673 $w += $this->CurrentFont[
'desc'][
'MissingWidth'];
3674 } elseif (isset($this->CurrentFont[
'MissingWidth'])) {
3675 $w += $this->CurrentFont[
'MissingWidth'];
3682 if (isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF) && !empty($OTLdata)) {
3683 if (isset($OTLdata[
'GPOSinfo'][$i][
'wDir']) && $OTLdata[
'GPOSinfo'][$i][
'wDir'] ==
'RTL') {
3684 if (isset($OTLdata[
'GPOSinfo'][$i][
'XAdvanceR']) && $OTLdata[
'GPOSinfo'][$i][
'XAdvanceR']) {
3685 $w += $OTLdata[
'GPOSinfo'][$i][
'XAdvanceR'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
3688 if (isset($OTLdata[
'GPOSinfo'][$i][
'XAdvanceL']) && $OTLdata[
'GPOSinfo'][$i][
'XAdvanceL']) {
3689 $w += $OTLdata[
'GPOSinfo'][$i][
'XAdvanceL'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
3694 if ($includeKashida && isset($OTLdata[
'GPOSinfo'][$i][
'kashida_space']) && $OTLdata[
'GPOSinfo'][$i][
'kashida_space']) {
3695 $kashida += $OTLdata[
'GPOSinfo'][$i][
'kashida_space'];
3699 if (isset($this->CurrentFont[
'kerninfo'][$lastchar][$char])) {
3700 $kerning += $this->CurrentFont[
'kerninfo'][$lastchar][$char];
3708 if ($this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats') {
3709 $s = str_replace(chr(173),
'', $s);
3711 $nb_carac = $l = strlen($s);
3712 if ($this->minwSpacing || $this->fixedlSpacing) {
3713 $nb_spaces = substr_count($s,
' ');
3715 for ($i = 0; $i < $l; $i++) {
3717 $charw =
$cw[chr($this->upperCase[ord($s[$i])])];
3718 if ($charw !==
false) {
3719 $charw = $charw * $this->smCapsScale * $this->smCapsStretch / 100;
3722 } elseif (isset(
$cw[$s[$i]])) {
3724 } elseif (isset(
$cw[ord($s[$i])])) {
3725 $w +=
$cw[ord($s[$i])];
3728 if (isset($this->CurrentFont[
'kerninfo'][$s[($i - 1)]][$s[$i]])) {
3729 $kerning += $this->CurrentFont[
'kerninfo'][$s[($i - 1)]][$s[$i]];
3738 $w *= ($this->FontSize / 1000);
3739 $w += (($nb_carac + $nb_spaces) * $this->fixedlSpacing) + ($nb_spaces * $this->minwSpacing);
3740 $w += $kashida / Mpdf::SCALE;
3748 $this->LineWidth = $width;
3749 $lwout = (sprintf(
'%.3F w', $width * Mpdf::SCALE));
3750 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'LineWidth']) && $this->pageoutput[$this->page][
'LineWidth'] != $lwout) || !isset($this->pageoutput[$this->page][
'LineWidth']))) {
3751 $this->writer->write($lwout);
3753 $this->pageoutput[$this->page][
'LineWidth'] = $lwout;
3759 $this->writer->write(sprintf(
'%.3F %.3F m %.3F %.3F l S', $x1 * Mpdf::SCALE, ($this->h - $y1) * Mpdf::SCALE, $x2 * Mpdf::SCALE, ($this->h - $y2) * Mpdf::SCALE));
3762 function Arrow($x1, $y1, $x2, $y2, $headsize = 3, $fill =
'B', $angle = 25)
3768 } elseif ($fill ==
'FD' or $fill ==
'DF' or $fill ==
'B') {
3773 $a = atan2(($y2 - $y1), ($x2 - $x1));
3774 $b = $a + deg2rad($angle);
3775 $c = $a - deg2rad($angle);
3776 $x3 = $x2 - ($headsize * cos($b));
3777 $y3 = $this->h - ($y2 - ($headsize * sin($b)));
3778 $x4 = $x2 - ($headsize * cos($c));
3779 $y4 = $this->h - ($y2 - ($headsize * sin($c)));
3781 $x5 = $x3 - ($x3 - $x4) / 2;
3782 $y5 = $y3 - ($y3 - $y4) / 2;
3785 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S', $x1 * Mpdf::SCALE, ($this->h - $y1) * Mpdf::SCALE, $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE);
3786 $this->writer->write($s);
3789 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l %.3F %.3F l %.3F %.3F l %.3F %.3F l ', $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE, $x3 * Mpdf::SCALE, $y3 * Mpdf::SCALE, $x2 * Mpdf::SCALE, ($this->h - $y2) * Mpdf::SCALE, $x4 * Mpdf::SCALE, $y4 * Mpdf::SCALE, $x5 * Mpdf::SCALE, $y5 * Mpdf::SCALE);
3791 $this->writer->write($s);
3794 function Rect($x, $y, $w, $h, $style =
'')
3797 if ($style ==
'F') {
3799 } elseif ($style ==
'FD' or $style ==
'DF') {
3804 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F re %s', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $w * Mpdf::SCALE, -$h * Mpdf::SCALE, $op));
3809 $this->fontDir[] = $directory;
3810 $this->fontFileFinder->setDirectories($this->fontDir);
3815 if (empty($family)) {
3819 $family = strtolower($family);
3820 $style = strtoupper($style);
3821 $style = str_replace(
'U',
'', $style);
3823 if ($style ==
'IB') {
3827 $fontkey = $family . $style;
3830 if (isset($this->fonts[$fontkey])) {
3835 if (in_array($family, $this->available_CJK_fonts)) {
3837 require __DIR__ .
'/../data/CJKdata.php';
3839 $this->AddCJKFont($family);
3844 if ($this->usingCoreFont) {
3845 throw new \Mpdf\MpdfException(
"mPDF Error - problem with Font management");
3853 if (!isset($this->fontdata[$family][$stylekey]) || !$this->fontdata[$family][$stylekey]) {
3854 throw new \Mpdf\MpdfException(sprintf(
'Font "%s%s%s" is not supported', $family, $style ?
' - ' :
'', $style));
3871 'fontmetrics' =>
'',
3872 'haskerninfo' =>
false,
3873 'haskernGPOS' =>
false,
3874 'hassmallcapsGSUB' =>
false,
3875 'BMPselected' =>
false,
3876 'GSUBScriptLang' => [],
3877 'GSUBFeatures' => [],
3878 'GSUBLookups' => [],
3879 'GPOSScriptLang' => [],
3880 'GPOSFeatures' => [],
3881 'GPOSLookups' => [],
3885 $fontCacheFilename = $fontkey .
'.mtx.json';
3886 if ($this->fontCache->jsonHas($fontCacheFilename)) {
3887 $font = $this->fontCache->jsonLoad($fontCacheFilename);
3890 $ttffile = $this->fontFileFinder->findFontFile($this->fontdata[$family][$stylekey]);
3891 $ttfstat = stat($ttffile);
3893 $TTCfontID = isset($this->fontdata[$family][
'TTCfontID'][$stylekey]) ? isset($this->fontdata[$family][
'TTCfontID'][$stylekey]) : 0;
3894 $fontUseOTL = isset($this->fontdata[$family][
'useOTL']) ? $this->fontdata[$family][
'useOTL'] :
false;
3895 $BMPonly = in_array($family, $this->BMPonly) ? true :
false;
3897 $regenerate =
false;
3898 if ($BMPonly && !$font[
'BMPselected']) {
3900 } elseif (!$BMPonly && $font[
'BMPselected']) {
3904 if ($fontUseOTL && $font[
'useOTL'] != $fontUseOTL) {
3906 $font[
'useOTL'] = $fontUseOTL;
3907 } elseif (!$fontUseOTL && $font[
'useOTL']) {
3909 $font[
'useOTL'] = 0;
3912 if ($this->fontDescriptor != $font[
'fontmetrics']) {
3916 if (empty($font[
'name']) || $font[
'originalsize'] != $ttfstat[
'size'] || $regenerate) {
3917 $generator =
new MetricsGenerator($this->fontCache, $this->fontDescriptor);
3919 $generator->generateMetrics(
3930 $font = $this->fontCache->jsonLoad($fontCacheFilename);
3931 $cw = $this->fontCache->load($fontkey .
'.cw.dat');
3932 $glyphIDtoUni = $this->fontCache->load($fontkey .
'.gid.dat');
3934 if ($this->fontCache->has($fontkey .
'.cw.dat')) {
3935 $cw = $this->fontCache->load($fontkey .
'.cw.dat');
3938 if ($this->fontCache->has($fontkey .
'.gid.dat')) {
3939 $glyphIDtoUni = $this->fontCache->load($fontkey .
'.gid.dat');
3943 if (isset($this->fontdata[$family][
'sip-ext']) && $this->fontdata[$family][
'sip-ext']) {
3944 $sipext = $this->fontdata[$family][
'sip-ext'];
3950 if (isset($this->fontdata[$family][
'Ascent']) && $this->fontdata[$family][
'Ascent']) {
3951 $desc[
'Ascent'] = $this->fontdata[$family][
'Ascent'];
3953 if (isset($this->fontdata[$family][
'Descent']) && $this->fontdata[$family][
'Descent']) {
3954 $desc[
'Descent'] = $this->fontdata[$family][
'Descent'];
3956 if (isset($this->fontdata[$family][
'Leading']) && $this->fontdata[$family][
'Leading']) {
3957 $desc[
'Leading'] = $this->fontdata[$family][
'Leading'];
3960 $i = count($this->fonts) + $this->extraFontSubsets + 1;
3962 $this->fonts[$fontkey] = [
3964 'name' => $font[
'name'],
3965 'type' => $font[
'type'],
3966 'desc' => $font[
'desc'],
3967 'panose' => $font[
'panose'],
3968 'unitsPerEm' => $font[
'unitsPerEm'],
3969 'up' => $font[
'up'],
3970 'ut' => $font[
'ut'],
3971 'strs' => $font[
'strs'],
3972 'strp' => $font[
'strp'],
3974 'ttffile' => $ttffile,
3975 'fontkey' => $fontkey,
3977 'sip' => $font[
'sip'],
3978 'sipext' => $sipext,
3979 'smp' => $font[
'smp'],
3980 'TTCfontID' => $TTCfontID,
3981 'useOTL' => $fontUseOTL,
3982 'useKashida' => (isset($this->fontdata[$family][
'useKashida']) ? $this->fontdata[$family][
'useKashida'] :
false),
3983 'GSUBScriptLang' => $font[
'GSUBScriptLang'],
3984 'GSUBFeatures' => $font[
'GSUBFeatures'],
3985 'GSUBLookups' => $font[
'GSUBLookups'],
3986 'GPOSScriptLang' => $font[
'GPOSScriptLang'],
3987 'GPOSFeatures' => $font[
'GPOSFeatures'],
3988 'GPOSLookups' => $font[
'GPOSLookups'],
3989 'rtlPUAstr' => $font[
'rtlPUAstr'],
3990 'glyphIDtoUni' => $glyphIDtoUni,
3991 'haskerninfo' => $font[
'haskerninfo'],
3992 'haskernGPOS' => $font[
'haskernGPOS'],
3993 'hassmallcapsGSUB' => $font[
'hassmallcapsGSUB'],
3997 if (!$font[
'sip'] && !$font[
'smp']) {
3998 $subsetRange = range(32, 127);
3999 $this->fonts[$fontkey][
'subset'] = array_combine($subsetRange, $subsetRange);
4001 $this->fonts[$fontkey][
'subsets'] = [0 => range(0, 127)];
4002 $this->fonts[$fontkey][
'subsetfontids'] = [$i];
4005 if ($font[
'haskerninfo']) {
4006 $this->fonts[$fontkey][
'kerninfo'] = $font[
'kerninfo'];
4009 $this->FontFiles[$fontkey] = [
4010 'length1' => $font[
'originalsize'],
4012 'ttffile' => $ttffile,
4013 'sip' => $font[
'sip'],
4014 'smp' => $font[
'smp'],
4020 function SetFont($family, $style =
'', $size = 0, $write =
true, $forcewrite =
false)
4022 $family = strtolower($family);
4024 if (!$this->onlyCoreFonts) {
4025 if ($family ==
'sans' || $family ==
'sans-serif') {
4026 $family = $this->sans_fonts[0];
4028 if ($family ==
'serif') {
4029 $family = $this->serif_fonts[0];
4031 if ($family ==
'mono' || $family ==
'monospace') {
4032 $family = $this->mono_fonts[0];
4036 if (isset($this->fonttrans[$family]) && $this->fonttrans[$family]) {
4037 $family = $this->fonttrans[$family];
4040 if ($family ==
'') {
4041 if ($this->FontFamily) {
4042 $family = $this->FontFamily;
4043 } elseif ($this->default_font) {
4044 $family = $this->default_font;
4046 throw new \Mpdf\MpdfException(
"No font or default font set!");
4050 $this->ReqFontStyle = $style;
4052 if (($family ==
'csymbol') || ($family ==
'czapfdingbats') || ($family ==
'ctimes') || ($family ==
'ccourier') || ($family ==
'chelvetica')) {
4053 if ($this->PDFA || $this->PDFX) {
4054 if ($family ==
'csymbol' || $family ==
'czapfdingbats') {
4055 throw new \Mpdf\MpdfException(
"Symbol and Zapfdingbats cannot be embedded in mPDF (required for PDFA1-b or PDFX/1-a).");
4057 if ($family ==
'ctimes' || $family ==
'ccourier' || $family ==
'chelvetica') {
4058 if (($this->PDFA && !$this->PDFAauto) || ($this->PDFX && !$this->PDFXauto)) {
4059 $this->PDFAXwarnings[] =
"Core Adobe font " . ucfirst($family) .
" cannot be embedded in mPDF, which is required for PDFA1-b or PDFX/1-a. (Embedded font will be substituted.)";
4061 if ($family ==
'chelvetica') {
4064 if ($family ==
'ctimes') {
4067 if ($family ==
'ccourier') {
4071 $this->usingCoreFont =
false;
4073 $this->usingCoreFont =
true;
4075 if ($family ==
'csymbol' || $family ==
'czapfdingbats') {
4079 $this->usingCoreFont =
false;
4084 $style = strtoupper($style);
4085 if ($style ==
'IB') {
4091 $size = $this->FontSizePt;
4094 $fontkey = $family . $style;
4102 if (!$this->onlyCoreFonts && !$this->usingCoreFont) {
4103 if (!isset($this->fonts[$fontkey]) || count($this->default_available_fonts) != count($this->available_unifonts)) {
4106 if (in_array($fontkey, $this->available_CJK_fonts)) {
4107 if (!isset($this->fonts[$fontkey])) {
4109 require __DIR__ .
'/../data/CJKdata.php';
4111 $this->AddCJKFont($family);
4114 if (!in_array($fontkey, $this->available_unifonts)) {
4116 if (in_array($family, $this->available_unifonts)) {
4119 elseif (count($this->available_unifonts) == 1) {
4120 $family = $this->available_unifonts[0];
4125 if (in_array($family, $this->sans_fonts)) {
4126 $i = array_intersect($this->sans_fonts, $this->available_unifonts);
4128 $i = array_values($i);
4130 if (!in_array(($i[0] . $style), $this->available_unifonts)) {
4136 } elseif (in_array($family, $this->serif_fonts)) {
4137 $i = array_intersect($this->serif_fonts, $this->available_unifonts);
4139 $i = array_values($i);
4141 if (!in_array(($i[0] . $style), $this->available_unifonts)) {
4147 } elseif (in_array($family, $this->mono_fonts)) {
4148 $i = array_intersect($this->mono_fonts, $this->available_unifonts);
4150 $i = array_values($i);
4152 if (!in_array(($i[0] . $style), $this->available_unifonts)) {
4162 $fs = $this->available_unifonts[0];
4163 preg_match(
'/^([a-z_0-9\-]+)([BI]{0,2})$/', $fs, $fas);
4165 $ws = $fas[1] . $style;
4166 if (in_array($ws, $this->available_unifonts)) {
4168 } elseif (in_array($fas[1], $this->available_unifonts)) {
4179 $fontkey = $family . $style;
4185 $this->AddFont($family, $style);
4188 if ($this->FontFamily == $family && $this->FontFamily == $this->currentfontfamily && $this->FontStyle == $style && $this->FontStyle == $this->currentfontstyle && $this->FontSizePt == $size && $this->FontSizePt == $this->currentfontsize && !$forcewrite) {
4192 $fontkey = $family . $style;
4195 $this->FontFamily = $family;
4196 $this->FontStyle = $style;
4197 $this->FontSizePt = $size;
4198 $this->FontSize = $size / Mpdf::SCALE;
4199 $this->CurrentFont = &$this->fonts[$fontkey];
4201 $fontout = (sprintf(
'BT /F%d %.3F Tf ET', $this->CurrentFont[
'i'], $this->FontSizePt));
4202 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'Font']) && $this->pageoutput[$this->page][
'Font'] != $fontout) || !isset($this->pageoutput[$this->page][
'Font']))) {
4203 $this->writer->write($fontout);
4205 $this->pageoutput[$this->page][
'Font'] = $fontout;
4209 $this->currentfontfamily = $family;
4210 $this->currentfontsize = $size;
4211 $this->currentfontstyle = $style;
4212 $this->setMBencoding(
'UTF-8');
4214 if ($this->PDFA || $this->PDFX) {
4215 throw new \Mpdf\MpdfException(
'Core Adobe fonts cannot be embedded in mPDF (required for PDFA1-b or PDFX/1-a) - cannot use option to use core fonts.');
4217 $this->setMBencoding(
'windows-1252');
4220 if (($this->FontFamily == $family) and ( $this->FontStyle == $style) and ( $this->FontSizePt == $size) && !$forcewrite) {
4224 if (!isset($this->CoreFonts[$fontkey])) {
4225 if (in_array($family, $this->serif_fonts)) {
4227 } elseif (in_array($family, $this->mono_fonts)) {
4228 $family =
'ccourier';
4230 $family =
'chelvetica';
4232 $this->usingCoreFont =
true;
4233 $fontkey = $family . $style;
4236 if (!isset($this->fonts[$fontkey])) {
4238 if (isset($this->CoreFonts[$fontkey])) {
4241 if ($family ==
'ctimes' || $family ==
'chelvetica' || $family ==
'ccourier') {
4242 $file .= strtolower($style);
4244 require __DIR__ .
'/../data/font/' . $file .
'.php';
4246 throw new \Mpdf\MpdfException(sprintf(
'Could not include font metric file "%s"', $file));
4248 $i = count($this->fonts) + $this->extraFontSubsets + 1;
4249 $this->fonts[$fontkey] = [
'i' => $i,
'type' =>
'core',
'name' => $this->CoreFonts[$fontkey],
'desc' =>
$desc,
'up' =>
$up,
'ut' =>
$ut,
'cw' =>
$cw];
4250 if ($this->useKerning && isset(
$kerninfo)) {
4251 $this->fonts[$fontkey][
'kerninfo'] =
$kerninfo;
4254 throw new \Mpdf\MpdfException(sprintf(
'Font %s not defined', $fontkey));
4259 if (($this->FontFamily == $family) and ( $this->FontStyle == $style) and ( $this->FontSizePt == $size) && !$forcewrite) {
4263 $this->FontFamily = $family;
4264 $this->FontStyle = $style;
4265 $this->FontSizePt = $size;
4266 $this->FontSize = $size / Mpdf::SCALE;
4267 $this->CurrentFont = &$this->fonts[$fontkey];
4269 $fontout = (sprintf(
'BT /F%d %.3F Tf ET', $this->CurrentFont[
'i'], $this->FontSizePt));
4270 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'Font']) && $this->pageoutput[$this->page][
'Font'] != $fontout) || !isset($this->pageoutput[$this->page][
'Font']))) {
4271 $this->writer->write($fontout);
4273 $this->pageoutput[$this->page][
'Font'] = $fontout;
4276 $this->currentfontfamily = $family;
4277 $this->currentfontsize = $size;
4278 $this->currentfontstyle = $style;
4287 if ($this->FontSizePt == $size) {
4290 $this->FontSizePt = $size;
4291 $this->FontSize = $size / Mpdf::SCALE;
4292 $this->currentfontsize = $size;
4294 $fontout = (sprintf(
'BT /F%d %.3F Tf ET', $this->CurrentFont[
'i'], $this->FontSizePt));
4296 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'Font']) && $this->pageoutput[$this->page][
'Font'] != $fontout) || !isset($this->pageoutput[$this->page][
'Font']))) {
4297 $this->writer->write($fontout);
4299 $this->pageoutput[$this->page][
'Font'] = $fontout;
4306 $n = count($this->links) + 1;
4307 $this->links[$n] = [0, 0];
4318 $page = $this->page;
4320 $this->links[$link] = [$page, $y];
4323 function Link($x, $y, $w, $h, $link)
4325 $l = [$x * Mpdf::SCALE, $this->hPt - $y * Mpdf::SCALE, $w * Mpdf::SCALE, $h * Mpdf::SCALE, $link];
4326 if ($this->keep_block_together) {
4328 } elseif ($this->table_rotate) {
4329 $this->tbrot_Links[$this->page][] = $l;
4332 elseif ($this->kwt) {
4333 $this->kwt_Links[$this->page][] = $l;
4337 if ($this->writingHTMLheader || $this->writingHTMLfooter) {
4338 $this->HTMLheaderPageLinks[] = $l;
4342 $this->PageLinks[$this->page][] = $l;
4344 $ref = count($this->PageLinks[$this->page]) - 1;
4345 $this->columnLinks[$this->CurrCol][(int) $this->x][(
int) $this->y] = $ref;
4348 function Text($x, $y, $txt, $OTLdata = [], $textvar = 0, $aixextra =
'', $coordsys =
'', $return =
false)
4357 if ($this->falseBoldWeight && strpos($this->ReqFontStyle,
"B") !==
false && strpos($this->FontStyle,
"B") ===
false) {
4358 $s .=
'2 Tr 1 J 1 j ';
4359 $s .= sprintf(
'%.3F w ', ($this->FontSize / 130) * Mpdf::SCALE * $this->falseBoldWeight);
4360 $tc = strtoupper($this->TextColor);
4361 if ($this->FillColor != $tc) {
4365 if (strpos($this->ReqFontStyle,
"I") !==
false && strpos($this->FontStyle,
"I") ===
false) {
4366 $aix =
'1 0 0.261799 1 %.3F %.3F Tm';
4368 $aix =
'%.3F %.3F Td';
4371 $aix = $aixextra . $aix;
4373 if ($this->ColorFlag) {
4374 $s .= $this->TextColor .
' ';
4377 $this->CurrentFont[
'used'] =
true;
4379 if ($this->usingCoreFont) {
4380 $txt2 = str_replace(chr(160), chr(32), $txt);
4382 $txt2 = str_replace(chr(194) . chr(160), chr(32), $txt);
4387 if ($coordsys !=
'SVG') {
4388 $px = $x * Mpdf::SCALE;
4389 $py = ($this->h - $y) * Mpdf::SCALE;
4398 $txt2 = $this->writer->escape($txt2);
4399 $s .= sprintf(
'BT ' . $aix .
' (%s) Tj ET', $px, $py, $txt2);
4402 elseif (!$this->usingCoreFont && !($textvar &
TextVars::FC_SMALLCAPS) && !($textvar &
TextVars::FC_KERNING) && !(isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF) && !empty($OTLdata[
'GPOSinfo']))) {
4404 if ($this->CurrentFont[
'sip'] || $this->CurrentFont[
'smp']) {
4405 $txt2 = $this->UTF8toSubset($txt2);
4406 $s .=sprintf(
'BT ' . $aix .
' %s Tj ET', $px, $py, $txt2);
4409 $txt2 = $this->writer->utf8ToUtf16BigEndian($txt2,
false);
4410 $txt2 = $this->writer->escape($txt2);
4411 $s .=sprintf(
'BT ' . $aix .
' (%s) Tj ET', $px, $py, $txt2);
4417 $s .= $this->applyGPOSpdf($txt2, $aix, $px, $py, $OTLdata, $textvar);
4424 $c = strtoupper($this->TextColor);
4425 if ($this->FillColor != $c) {
4426 $s.=
' ' . $c .
' ';
4428 if (isset($this->CurrentFont[
'up']) && $this->CurrentFont[
'up']) {
4429 $up = $this->CurrentFont[
'up'];
4433 $adjusty = (-
$up / 1000 * $this->FontSize);
4434 if (isset($this->CurrentFont[
'ut']) && $this->CurrentFont[
'ut']) {
4435 $ut = $this->CurrentFont[
'ut'] / 1000 * $this->FontSize;
4437 $ut = 60 / 1000 * $this->FontSize;
4439 $olw = $this->LineWidth;
4440 $s .=
' ' . (sprintf(
' %.3F w',
$ut * Mpdf::SCALE));
4441 $s .=
' ' . $this->_dounderline($x, $y + $adjusty, $txt, $OTLdata, $textvar);
4442 $s .=
' ' . (sprintf(
' %.3F w', $olw * Mpdf::SCALE));
4443 if ($this->FillColor != $c) {
4444 $s.=
' ' . $this->FillColor .
' ';
4449 $c = strtoupper($this->TextColor);
4450 if ($this->FillColor != $c) {
4451 $s.=
' ' . $c .
' ';
4454 if (isset($this->CurrentFont[
'desc'][
'CapHeight']) && $this->CurrentFont[
'desc'][
'CapHeight']) {
4455 $ch = $this->CurrentFont[
'desc'][
'CapHeight'];
4459 $adjusty = (-$ch / 1000 * $this->FontSize) * 0.35;
4460 if (isset($this->CurrentFont[
'ut']) && $this->CurrentFont[
'ut']) {
4461 $ut = $this->CurrentFont[
'ut'] / 1000 * $this->FontSize;
4463 $ut = 60 / 1000 * $this->FontSize;
4465 $olw = $this->LineWidth;
4466 $s .=
' ' . (sprintf(
' %.3F w',
$ut * Mpdf::SCALE));
4467 $s .=
' ' . $this->_dounderline($x, $y + $adjusty, $txt, $OTLdata, $textvar);
4468 $s .=
' ' . (sprintf(
' %.3F w', $olw * Mpdf::SCALE));
4469 if ($this->FillColor != $c) {
4470 $s.=
' ' . $this->FillColor .
' ';
4478 $this->writer->write($s);
4486 $txt = $this->purify_utf8_text($txt);
4487 if ($this->text_input_as_HTML) {
4488 $txt = $this->all_entities_to_utf8($txt);
4490 if ($this->usingCoreFont) {
4491 $txt = mb_convert_encoding($txt, $this->mb_enc,
'UTF-8');
4495 if (preg_match(
"/([" . $this->pregRTLchars .
"])/u", $txt)) {
4496 $this->biDirectional =
true;
4500 $save_OTLtags = $this->OTLtags;
4501 $this->OTLtags = [];
4502 if ($this->useKerning) {
4503 if ($this->CurrentFont[
'haskernGPOS']) {
4504 $this->OTLtags[
'Plus'] .=
' kern';
4512 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
4513 $txt = $this->otl->applyOTL($txt, $this->CurrentFont[
'useOTL']);
4514 $OTLdata = $this->otl->OTLdata;
4517 $this->OTLtags = $save_OTLtags;
4519 $this->magic_reverse_dir($txt, $this->directionality, $OTLdata);
4521 $this->Text($x, $y, $txt, $OTLdata, $textvar);
4524 function WriteCell($w, $h = 0, $txt =
'', $border = 0, $ln = 0, $align =
'', $fill = 0, $link =
'', $currentx = 0)
4527 $txt = $this->purify_utf8_text($txt);
4528 if ($this->text_input_as_HTML) {
4529 $txt = $this->all_entities_to_utf8($txt);
4531 if ($this->usingCoreFont) {
4532 $txt = mb_convert_encoding($txt, $this->mb_enc,
'UTF-8');
4535 if (preg_match(
"/([" . $this->pregRTLchars .
"])/u", $txt)) {
4536 $this->biDirectional =
true;
4540 $save_OTLtags = $this->OTLtags;
4541 $this->OTLtags = [];
4542 if ($this->useKerning) {
4543 if ($this->CurrentFont[
'haskernGPOS']) {
4544 $this->OTLtags[
'Plus'] .=
' kern';
4552 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
4553 $txt = $this->otl->applyOTL($txt, $this->CurrentFont[
'useOTL']);
4554 $OTLdata = $this->otl->OTLdata;
4557 $this->OTLtags = $save_OTLtags;
4559 $this->magic_reverse_dir($txt, $this->directionality, $OTLdata);
4561 $this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link, $currentx, 0, 0,
'M', 0,
false, $OTLdata, $textvar);
4568 if ($this->ws != 0) {
4569 $this->writer->write(
'BT 0 Tw ET');
4572 if ($this->charspacing != 0) {
4573 $this->writer->write(
'BT 0 Tc ET');
4575 $this->charspacing = 0;
4580 if (intval($cs * 1000) == 0) {
4584 $this->writer->write(sprintf(
'BT %.3F Tc ET', $cs));
4585 } elseif ($this->charspacing != 0) {
4586 $this->writer->write(
'BT 0 Tc ET');
4588 $this->charspacing = $cs;
4589 if (intval($ws * 1000) == 0) {
4593 $this->writer->write(sprintf(
'BT %.3F Tw ET', $ws));
4594 } elseif ($this->ws != 0) {
4595 $this->writer->write(
'BT 0 Tw ET');
4603 $kashida_present =
false;
4605 if ($w > 0 && $inclCursive && isset($this->CurrentFont[
'useKashida']) && $this->CurrentFont[
'useKashida'] && !empty($cOTLdata)) {
4606 for ($c = 0; $c < count($cOTLdata); $c++) {
4607 for ($i = 0; $i < strlen($cOTLdata[$c][
'group']); $i++) {
4608 if (isset($cOTLdata[$c][
'GPOSinfo'][$i][
'kashida']) && $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'] > 0) {
4609 $kashida_present =
true;
4616 if ($kashida_present) {
4620 $max_kashida_in_word = 0;
4621 $last_kashida_in_word = -1;
4623 for ($c = 0; $c < count($cOTLdata); $c++) {
4624 for ($i = 0; $i < strlen($cOTLdata[$c][
'group']); $i++) {
4625 if ($cOTLdata[$c][
'group'][$i] ==
'S') {
4627 if ($max_kashida_in_word) {
4629 $k_total = $max_kashida_in_word;
4632 $max_kashida_in_word = 0;
4633 $last_kashida_in_word = -1;
4636 if (isset($cOTLdata[$c][
'GPOSinfo'][$i][
'kashida']) && $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'] > 0) {
4637 if ($max_kashida_in_word) {
4638 if ($cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'] > $max_kashida_in_word) {
4639 $max_kashida_in_word = $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'];
4640 $cOTLdata[$c][
'GPOSinfo'][$last_kashida_in_word][
'kashida'] = 0;
4641 $last_kashida_in_word = $i;
4643 $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'] = 0;
4646 $max_kashida_in_word = $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'];
4647 $last_kashida_in_word = $i;
4653 if ($max_kashida_in_word) {
4655 $k_total = $max_kashida_in_word;
4661 $kashida_space_ratio = intval($this->CurrentFont[
'useKashida']) / 100;
4664 $kashida_space = $w * $kashida_space_ratio;
4666 $tatw = $this->_getCharWidth($this->CurrentFont[
'cw'], 0x0640);
4670 if ($tatw && (($kashida_space / $k_ctr) / $tatw) > 0.01) {
4671 for ($c = 0; $c < count($cOTLdata); $c++) {
4672 for ($i = 0; $i < strlen($cOTLdata[$c][
'group']); $i++) {
4673 if (isset($cOTLdata[$c][
'GPOSinfo'][$i][
'kashida']) && $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida'] > 0) {
4677 $cOTLdata[$c][
'GPOSinfo'][$i][
'kashida_space'] = (1 / $k_ctr) * $kashida_space;
4681 $w -= $kashida_space;
4687 $ww = $this->jSWord;
4692 elseif ($this->fixedlSpacing !==
false || $inclCursive) {
4696 } elseif ($nc == 1) {
4699 $charspacing = $w / ($ncx );
4700 if (($this->jSmaxChar > 0) && ($charspacing > $this->jSmaxChar)) {
4701 $charspacing = $this->jSmaxChar;
4703 } elseif ($ns == ($ncx )) {
4704 $charspacing = $w / $ns;
4706 if ($this->usingCoreFont) {
4707 $cs = ($w * (1 - $this->jSWord)) / ($ncx );
4708 if (($this->jSmaxChar > 0) && ($cs > $this->jSmaxChar)) {
4709 $cs = $this->jSmaxChar;
4710 $ww = 1 - (($cs * ($ncx )) / $w);
4713 $ws = ($w * ($ww) ) / $ns;
4715 $cs = ($w * (1 - $this->jSWord)) / ($ncx - $ns);
4716 if (($this->jSmaxChar > 0) && ($cs > $this->jSmaxChar)) {
4717 $cs = $this->jSmaxChar;
4718 $ww = 1 - (($cs * ($ncx - $ns)) / $w);
4721 $ws = (($w * ($ww) ) / $ns) - $charspacing;
4724 return [$charspacing, $ws, $kashida_space];
4734 function Cell($w, $h = 0, $txt =
'', $border = 0, $ln = 0, $align =
'', $fill = 0, $link =
'', $currentx = 0, $lcpaddingL = 0, $lcpaddingR = 0, $valign =
'M', $spanfill = 0, $exactWidth =
false, $OTLdata =
false, $textvar = 0, $lineBox =
false)
4737 if ($this->usingCoreFont) {
4738 $txt = str_replace(chr(160), chr(32), $txt);
4740 $txt = str_replace(chr(194) . chr(160), chr(32), $txt);
4743 $oldcolumn = $this->CurrCol;
4747 if (isset($this->blk[$this->blklvl])) {
4748 $bottom = $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'margin_bottom'];
4753 if (!$this->tableLevel
4755 ($this->y + $this->divheight > $this->PageBreakTrigger)
4756 || ($this->y + $h > $this->PageBreakTrigger)
4758 $this->y + ($h * 2) + $bottom > $this->PageBreakTrigger
4759 && $this->blk[$this->blklvl][
'page_break_after_avoid']
4763 && $this->AcceptPageBreak()
4770 $charspacing = $this->charspacing;
4771 $this->ResetSpacing();
4773 $this->
AddPage($this->CurOrientation);
4776 $x += $this->MarginCorrection;
4778 $currentx += $this->MarginCorrection;
4782 $this->SetSpacing($charspacing, $ws);
4791 if ($this->CurrCol != $oldcolumn) {
4793 $currentx += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
4795 $this->x += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
4799 if ($this->ColActive) {
4801 $this->ColDetails[$this->CurrCol][
'bottom_margin'] = $this->y + $h;
4803 $this->ColDetails[$this->CurrCol][
'bottom_margin'] = $this->y + $this->divheight;
4810 $w = $this->w - $this->rMargin - $this->x;
4814 if ($fill == 1 && $this->FillColor) {
4815 if ((isset($this->pageoutput[$this->page][
'FillColor']) && $this->pageoutput[$this->page][
'FillColor'] != $this->FillColor) || !isset($this->pageoutput[$this->page][
'FillColor'])) {
4816 $s .= $this->FillColor .
' ';
4818 $this->pageoutput[$this->page][
'FillColor'] = $this->FillColor;
4821 if ($lineBox && isset($lineBox[
'boxtop']) && $txt) {
4823 $boxtop = $this->y + $lineBox[
'boxtop'];
4824 $boxbottom = $this->y + $lineBox[
'boxbottom'];
4825 $glyphYorigin = $lineBox[
'glyphYorigin'];
4826 $baseline_shift = $lineBox[
'baseline-shift'];
4827 $bord_boxtop = $bg_boxtop = $boxtop = $boxtop - $baseline_shift;
4828 $bord_boxbottom = $bg_boxbottom = $boxbottom = $boxbottom - $baseline_shift;
4829 $bord_boxheight = $bg_boxheight = $boxheight = $boxbottom - $boxtop;
4832 if (isset($lineBox[
'background-boxtop'])) {
4833 $bg_boxtop = $this->y + $lineBox[
'background-boxtop'] - $lineBox[
'background-baseline-shift'];
4834 $bg_boxbottom = $this->y + $lineBox[
'background-boxbottom'] - $lineBox[
'background-baseline-shift'];
4835 $bg_boxheight = $bg_boxbottom - $bg_boxtop;
4838 if (isset($lineBox[
'border-boxtop'])) {
4839 $bord_boxtop = $this->y + $lineBox[
'border-boxtop'] - $lineBox[
'border-baseline-shift'];
4840 $bord_boxbottom = $this->y + $lineBox[
'border-boxbottom'] - $lineBox[
'border-baseline-shift'];
4841 $bord_boxheight = $bord_boxbottom - $bord_boxtop;
4848 $boxbottom = $this->y + $h;
4849 $baseline_shift = 0;
4854 $bfs = $this->FontSize;
4856 $bfx = $this->baselineC;
4857 $baseline = $bfx * $bfs;
4860 $baseline_shift = $this->textparam[
'text-baseline'];
4862 $baseline_shift = $this->textparam[
'text-baseline'];
4863 } elseif ($this->bullet) {
4864 $baseline += ($bfx - 0.7) * $this->FontSize;
4868 if ($valign ==
'T') {
4869 $va = (0.5 * $bfs * $this->normalLineheight);
4870 } elseif ($valign ==
'B') {
4871 $va = $h - (0.5 * $bfs * $this->normalLineheight);
4878 if ($spanfill || !empty($this->spanborddet) || $link !=
'') {
4880 $boxtop = $this->y + $baseline + $va - ($this->FontSize * (1 + $exth / 2) * (0.5 + $bfx));
4881 $boxheight = $this->FontSize * (1 + $exth);
4882 $boxbottom = $boxtop + $boxheight;
4885 $glyphYorigin = $baseline + $va;
4888 $boxtop -= $baseline_shift;
4889 $boxbottom -= $baseline_shift;
4890 $bord_boxtop = $bg_boxtop = $boxtop;
4891 $bord_boxbottom = $bg_boxbottom = $boxbottom;
4892 $bord_boxheight = $bg_boxheight = $boxheight = $boxbottom - $boxtop;
4895 $bbw = $tbw = $lbw = $rbw = 0;
4896 if (!empty($this->spanborddet)) {
4898 if (!isset($this->spanborddet[
'B'])) {
4899 $this->spanborddet[
'B'] = [
's' => 0,
'style' =>
'',
'w' => 0];
4902 if (!isset($this->spanborddet[
'T'])) {
4903 $this->spanborddet[
'T'] = [
's' => 0,
'style' =>
'',
'w' => 0];
4906 if (!isset($this->spanborddet[
'L'])) {
4907 $this->spanborddet[
'L'] = [
's' => 0,
'style' =>
'',
'w' => 0];
4910 if (!isset($this->spanborddet[
'R'])) {
4911 $this->spanborddet[
'R'] = [
's' => 0,
'style' =>
'',
'w' => 0];
4914 $bbw = $this->spanborddet[
'B'][
'w'];
4915 $tbw = $this->spanborddet[
'T'][
'w'];
4916 $lbw = $this->spanborddet[
'L'][
'w'];
4917 $rbw = $this->spanborddet[
'R'][
'w'];
4920 if ($fill == 1 || $border == 1 || !empty($this->spanborddet)) {
4922 if (!empty($this->spanborddet)) {
4925 $s .= sprintf(
'%.3F %.3F %.3F %.3F re f ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bg_boxtop + $tbw) * Mpdf::SCALE, ($w + $lbw + $rbw) * Mpdf::SCALE, (-$bg_boxheight - $tbw - $bbw) * Mpdf::SCALE);
4936 if ($this->spanborddet[
'T'][
'style'] ==
'dashed') {
4937 $s .= sprintf(
' 0 j 0 J [%.3F %.3F] 0 d ', $tbw * $dashon * Mpdf::SCALE, $tbw * $dashoff * Mpdf::SCALE);
4938 } elseif ($this->spanborddet[
'T'][
'style'] ==
'dotted') {
4939 $s .= sprintf(
' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $tbw * $dot * Mpdf::SCALE, -$tbw / 2 * Mpdf::SCALE);
4942 $s .=
' 0 j 0 J [] 0 d ';
4945 if ($this->spanborddet[
'T'][
'style'] !=
'dotted') {
4947 $s .= sprintf(
'%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
4948 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
4949 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
4950 $s .= sprintf(
'%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
4954 $c = $this->SetDColor($this->spanborddet[
'T'][
'c'],
true);
4956 if ($this->spanborddet[
'T'][
'style'] ==
'double') {
4957 $s .= sprintf(
' %s %.3F w ', $c, $tbw / 3 * Mpdf::SCALE);
4958 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw * 5 / 6) * Mpdf::SCALE, ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw * 5 / 6) * Mpdf::SCALE);
4959 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 6) * Mpdf::SCALE, ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 6) * Mpdf::SCALE);
4960 } elseif ($this->spanborddet[
'T'][
'style'] ==
'dotted') {
4961 $s .= sprintf(
' %s %.3F w ', $c, $tbw * Mpdf::SCALE);
4962 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE);
4964 $s .= sprintf(
' %s %.3F w ', $c, $tbw * Mpdf::SCALE);
4965 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw / 2) * Mpdf::SCALE);
4968 if ($this->spanborddet[
'T'][
'style'] !=
'dotted') {
4975 if ($this->spanborddet[
'B'][
'style'] ==
'dashed') {
4976 $s .= sprintf(
' 0 j 0 J [%.3F %.3F] 0 d ', $bbw * $dashon * Mpdf::SCALE, $bbw * $dashoff * Mpdf::SCALE);
4977 } elseif ($this->spanborddet[
'B'][
'style'] ==
'dotted') {
4978 $s .= sprintf(
' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $bbw * $dot * Mpdf::SCALE, -$bbw / 2 * Mpdf::SCALE);
4981 $s .=
' 0 j 0 J [] 0 d ';
4984 if ($this->spanborddet[
'B'][
'style'] !=
'dotted') {
4986 $s .= sprintf(
'%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
4987 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
4988 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w) * Mpdf::SCALE, ($this->h - $bord_boxbottom) * Mpdf::SCALE);
4989 $s .= sprintf(
'%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxbottom) * Mpdf::SCALE);
4993 $c = $this->SetDColor($this->spanborddet[
'B'][
'c'],
true);
4995 if ($this->spanborddet[
'B'][
'style'] ==
'double') {
4996 $s .= sprintf(
' %s %.3F w ', $c, $bbw / 3 * Mpdf::SCALE);
4997 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 6) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 6) * Mpdf::SCALE);
4998 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw * 5 / 6) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw * 5 / 6) * Mpdf::SCALE);
4999 } elseif ($this->spanborddet[
'B'][
'style'] ==
'dotted') {
5000 $s .= sprintf(
' %s %.3F w ', $c, $bbw * Mpdf::SCALE);
5001 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE);
5003 $s .= sprintf(
' %s %.3F w ', $c, $bbw * Mpdf::SCALE);
5004 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE, ($this->x + $w + $rbw - $short) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw / 2) * Mpdf::SCALE);
5007 if ($this->spanborddet[
'B'][
'style'] !=
'dotted') {
5014 if ($this->spanborddet[
'L'][
'style'] ==
'dashed') {
5015 $s .= sprintf(
' 0 j 0 J [%.3F %.3F] 0 d ', $lbw * $dashon * Mpdf::SCALE, $lbw * $dashoff * Mpdf::SCALE);
5016 } elseif ($this->spanborddet[
'L'][
'style'] ==
'dotted') {
5017 $s .= sprintf(
' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $lbw * $dot * Mpdf::SCALE, -$lbw / 2 * Mpdf::SCALE);
5020 $s .=
' 0 j 0 J [] 0 d ';
5023 if ($this->spanborddet[
'L'][
'style'] !=
'dotted') {
5025 $s .= sprintf(
'%.3F %.3F m ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
5026 $s .= sprintf(
'%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxbottom) * Mpdf::SCALE);
5027 $s .= sprintf(
'%.3F %.3F l ', ($this->x) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
5028 $s .= sprintf(
'%.3F %.3F l ', ($this->x - $lbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
5032 $c = $this->SetDColor($this->spanborddet[
'L'][
'c'],
true);
5033 if ($this->spanborddet[
'L'][
'style'] ==
'double') {
5034 $s .= sprintf(
' %s %.3F w ', $c, $lbw / 3 * Mpdf::SCALE);
5035 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5036 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5037 } elseif ($this->spanborddet[
'L'][
'style'] ==
'dotted') {
5038 $s .= sprintf(
' %s %.3F w ', $c, $lbw * Mpdf::SCALE);
5039 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5041 $s .= sprintf(
' %s %.3F w ', $c, $lbw * Mpdf::SCALE);
5042 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x - $lbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5045 if ($this->spanborddet[
'L'][
'style'] !=
'dotted') {
5053 if ($this->spanborddet[
'R'][
'style'] ==
'dashed') {
5054 $s .= sprintf(
' 0 j 0 J [%.3F %.3F] 0 d ', $rbw * $dashon * Mpdf::SCALE, $rbw * $dashoff * Mpdf::SCALE);
5055 } elseif ($this->spanborddet[
'R'][
'style'] ==
'dotted') {
5056 $s .= sprintf(
' 1 j 1 J [%.3F %.3F] %.3F d ', 0.001, $rbw * $dot * Mpdf::SCALE, -$rbw / 2 * Mpdf::SCALE);
5059 $s .=
' 0 j 0 J [] 0 d ';
5062 if ($this->spanborddet[
'R'][
'style'] !=
'dotted') {
5064 $s .= sprintf(
'%.3F %.3F m ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw) * Mpdf::SCALE);
5065 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w) * Mpdf::SCALE, ($this->h - $bord_boxbottom) * Mpdf::SCALE);
5066 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
5067 $s .= sprintf(
'%.3F %.3F l ', ($this->x + $w + $rbw) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE);
5071 $c = $this->SetDColor($this->spanborddet[
'R'][
'c'],
true);
5072 if ($this->spanborddet[
'R'][
'style'] ==
'double') {
5073 $s .= sprintf(
' %s %.3F w ', $c, $rbw / 3 * Mpdf::SCALE);
5074 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5075 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw * 5 / 6) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5076 } elseif ($this->spanborddet[
'R'][
'style'] ==
'dotted') {
5077 $s .= sprintf(
' %s %.3F w ', $c, $rbw * Mpdf::SCALE);
5078 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5080 $s .= sprintf(
' %s %.3F w ', $c, $rbw * Mpdf::SCALE);
5081 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxtop + $tbw) * Mpdf::SCALE, ($this->x + $w + $rbw / 2) * Mpdf::SCALE, ($this->h - $bord_boxbottom - $bbw + $short) * Mpdf::SCALE);
5084 if ($this->spanborddet[
'R'][
'style'] !=
'dotted') {
5094 $op = ($border == 1) ?
'B' :
'f';
5099 $s .= sprintf(
'%.3F %.3F %.3F %.3F re %s ', $this->x * Mpdf::SCALE, ($this->h - $bg_boxtop) * Mpdf::SCALE, $w * Mpdf::SCALE, -$bg_boxheight * Mpdf::SCALE, $op);
5103 if (is_string($border)) {
5108 if (is_int(strpos($border,
'L'))) {
5109 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
5112 if (is_int(strpos($border,
'T'))) {
5113 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE);
5116 if (is_int(strpos($border,
'R'))) {
5117 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', ($x + $w) * Mpdf::SCALE, ($this->h - $bord_boxtop) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
5120 if (is_int(strpos($border,
'B'))) {
5121 $s .= sprintf(
'%.3F %.3F m %.3F %.3F l S ', $x * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE, ($x + $w) * Mpdf::SCALE, ($this->h - ($bord_boxbottom)) * Mpdf::SCALE);
5130 $stringWidth = $this->GetStringWidth($txt,
true, $OTLdata, $textvar) + ( $this->charspacing * mb_strlen($txt, $this->mb_enc) / Mpdf::SCALE ) + ( $this->ws * mb_substr_count($txt,
' ', $this->mb_enc) / Mpdf::SCALE );
5134 if ($align ==
'R') {
5135 $dx = $w - $this->cMarginR - $stringWidth - $lcpaddingR;
5136 } elseif ($align ==
'C') {
5137 $dx = (($w - $stringWidth ) / 2);
5138 } elseif ($align ==
'L' or $align ==
'J') {
5139 $dx = $this->cMarginL + $lcpaddingL;
5144 if ($this->ColorFlag) {
5145 $s .=
'q ' . $this->TextColor .
' ';
5149 if (isset($this->textparam[
'outline-s']) && $this->textparam[
'outline-s'] && !($textvar &
TextVars::FC_SMALLCAPS)) {
5150 $s .=
' ' . sprintf(
'%.3F w', $this->LineWidth * Mpdf::SCALE) .
' ';
5151 $s .=
" $this->DrawColor ";
5153 } elseif ($this->falseBoldWeight && strpos($this->ReqFontStyle,
"B") !==
false && strpos($this->FontStyle,
"B") ===
false && !($textvar &
TextVars::FC_SMALLCAPS)) {
5154 $s .=
' 2 Tr 1 J 1 j ';
5155 $s .=
' ' . sprintf(
'%.3F w', ($this->FontSize / 130) * Mpdf::SCALE * $this->falseBoldWeight) .
' ';
5156 $tc = strtoupper($this->TextColor);
5157 if ($this->FillColor != $tc) {
5158 $s .=
' ' . $tc .
' ';
5164 if (strpos($this->ReqFontStyle,
"I") !==
false && strpos($this->FontStyle,
"I") ===
false) {
5165 $aix =
'1 0 0.261799 1 %.3F %.3F Tm ';
5167 $aix =
'%.3F %.3F Td ';
5170 $px = ($this->x + $dx) * Mpdf::SCALE;
5171 $py = ($this->h - ($this->y + $glyphYorigin - $baseline_shift)) * Mpdf::SCALE;
5176 $this->CurrentFont[
'used'] =
true;
5183 $txt2 = $this->writer->escape($txt2);
5184 $sub .= sprintf(
'BT ' . $aix .
' (%s) Tj ET', $px, $py, $txt2);
5187 elseif (!$this->usingCoreFont && !$this->ws && !($textvar &
TextVars::FC_SMALLCAPS) && !($textvar &
TextVars::FC_KERNING) && !(isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF) && !empty($OTLdata[
'GPOSinfo']))) {
5189 if ((isset($this->CurrentFont[
'sip']) && $this->CurrentFont[
'sip']) || (isset($this->CurrentFont[
'smp']) && $this->CurrentFont[
'smp'])) {
5190 $txt2 = $this->UTF8toSubset($txt2);
5191 $sub .=sprintf(
'BT ' . $aix .
' %s Tj ET', $px, $py, $txt2);
5194 $txt2 = $this->writer->utf8ToUtf16BigEndian($txt2,
false);
5195 $txt2 = $this->writer->escape($txt2);
5196 $sub .=sprintf(
'BT ' . $aix .
' (%s) Tj ET', $px, $py, $txt2);
5201 elseif (!$this->usingCoreFont && $this->ws && !((isset($this->CurrentFont[
'sip']) && $this->CurrentFont[
'sip']) || (isset($this->CurrentFont[
'smp']) && $this->CurrentFont[
'smp'])) && !($textvar &
TextVars::FC_SMALLCAPS) && !($textvar &
TextVars::FC_KERNING) && !(isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF) && (!empty($OTLdata[
'GPOSinfo']) || (strpos($OTLdata[
'group'],
'M') !==
false && $this->charspacing)) )) {
5203 $space = $this->writer->utf8ToUtf16BigEndian($space,
false);
5204 $space = $this->writer->escape($space);
5205 $sub .=sprintf(
'BT ' . $aix .
' %.3F Tc [', $px, $py, $this->charspacing);
5206 $t = explode(
' ', $txt2);
5208 for ($i = 0; $i < $numt; $i++) {
5210 $tx = $this->writer->utf8ToUtf16BigEndian($tx,
false);
5211 $tx = $this->writer->escape($tx);
5212 $sub .=sprintf(
'(%s) ', $tx);
5213 if (($i + 1) < $numt) {
5214 $adj = -($this->ws) * 1000 / $this->FontSizePt;
5215 $sub .=sprintf(
'%d(%s) ', $adj, $space);
5222 $sub = $this->applyGPOSpdf($txt, $aix, $px, $py, $OTLdata, $textvar);
5227 if ($this->shrin_k > 1) {
5228 $shrin_k = $this->shrin_k;
5238 $c = isset($this->textparam[
'u-decoration'][
'color']) ? $this->textparam[
'u-decoration'][
'color'] :
'';
5239 if ($this->FillColor != $c) {
5240 $sub .=
' ' . $c .
' ';
5244 $decorationfontkey = isset($this->textparam[
'u-decoration'][
'fontkey']) ? $this->textparam[
'u-decoration'][
'fontkey'] :
'';
5245 $decorationfontsize = isset($this->textparam[
'u-decoration'][
'fontsize']) ? $this->textparam[
'u-decoration'][
'fontsize'] / $shrin_k : 0;
5247 if (isset($this->fonts[$decorationfontkey][
'ut']) && $this->fonts[$decorationfontkey][
'ut']) {
5248 $ut = $this->fonts[$decorationfontkey][
'ut'] / 1000 * $decorationfontsize;
5250 $ut = 60 / 1000 * $decorationfontsize;
5253 if (isset($this->fonts[$decorationfontkey][
'up']) && $this->fonts[$decorationfontkey][
'up']) {
5254 $up = $this->fonts[$decorationfontkey][
'up'];
5259 $adjusty = (-
$up / 1000 * $decorationfontsize) +
$ut / 2;
5260 $ubaseline = isset($this->textparam[
'u-decoration'][
'baseline'])
5261 ? $glyphYorigin - $this->textparam[
'u-decoration'][
'baseline'] / $shrin_k
5264 $olw = $this->LineWidth;
5266 $sub .=
' ' . (sprintf(
' %.3F w 0 j 0 J ',
$ut * Mpdf::SCALE));
5267 $sub .=
' ' . $this->_dounderline($this->x + $dx, $this->y + $ubaseline + $adjusty, $txt, $OTLdata, $textvar);
5268 $sub .=
' ' . (sprintf(
' %.3F w 2 j 2 J ', $olw * Mpdf::SCALE));
5270 if ($this->FillColor != $c) {
5271 $sub .=
' ' . $this->FillColor .
' ';
5279 $c = $this->textparam[
's-decoration'][
'color'];
5281 if ($this->FillColor != $c) {
5282 $sub .=
' ' . $c .
' ';
5286 $decorationfontkey = $this->textparam[
's-decoration'][
'fontkey'];
5287 $decorationfontsize = $this->textparam[
's-decoration'][
'fontsize'] / $shrin_k;
5290 if (isset($this->fonts[$decorationfontkey][
'strs']) && $this->fonts[$decorationfontkey][
'strs']) {
5291 $ut = $this->fonts[$decorationfontkey][
'strs'] / 1000 * $decorationfontsize;
5293 elseif (isset($this->fonts[$decorationfontkey][
'ut']) && $this->fonts[$decorationfontkey][
'ut']) {
5294 $ut = $this->fonts[$decorationfontkey][
'ut'] / 1000 * $decorationfontsize;
5296 $ut = 50 / 1000 * $decorationfontsize;
5300 if (isset($this->fonts[$decorationfontkey][
'strp']) && $this->fonts[$decorationfontkey][
'strp']) {
5301 $up = $this->fonts[$decorationfontkey][
'strp'];
5302 $adjusty = (-
$up / 1000 * $decorationfontsize);
5305 if (isset($this->fonts[$decorationfontkey][
'desc'][
'CapHeight']) && $this->fonts[$decorationfontkey][
'desc'][
'CapHeight']) {
5306 $ch = $this->fonts[$decorationfontkey][
'desc'][
'CapHeight'];
5310 $adjusty = (-$ch / 1000 * $decorationfontsize) * $this->baselineS;
5313 $sbaseline = $glyphYorigin - $this->textparam[
's-decoration'][
'baseline'] / $shrin_k;
5315 $olw = $this->LineWidth;
5317 $sub .=
' ' . (sprintf(
' %.3F w 0 j 0 J ',
$ut * Mpdf::SCALE));
5318 $sub .=
' ' . $this->_dounderline($this->x + $dx, $this->y + $sbaseline + $adjusty, $txt, $OTLdata, $textvar);
5319 $sub .=
' ' . (sprintf(
' %.3F w 2 j 2 J ', $olw * Mpdf::SCALE));
5321 if ($this->FillColor != $c) {
5322 $sub .=
' ' . $this->FillColor .
' ';
5330 $c = $this->textparam[
'o-decoration'][
'color'];
5331 if ($this->FillColor != $c) {
5332 $sub .=
' ' . $c .
' ';
5336 $decorationfontkey = (int) (((
float) $this->textparam[
'o-decoration'][
'fontkey']) / $shrin_k);
5337 $decorationfontsize = $this->textparam[
'o-decoration'][
'fontsize'];
5339 if (isset($this->fonts[$decorationfontkey][
'ut']) && $this->fonts[$decorationfontkey][
'ut']) {
5340 $ut = $this->fonts[$decorationfontkey][
'ut'] / 1000 * $decorationfontsize;
5342 $ut = 60 / 1000 * $decorationfontsize;
5344 if (isset($this->fonts[$decorationfontkey][
'desc'][
'CapHeight']) && $this->fonts[$decorationfontkey][
'desc'][
'CapHeight']) {
5345 $ch = $this->fonts[$decorationfontkey][
'desc'][
'CapHeight'];
5349 $adjusty = (-$ch / 1000 * $decorationfontsize) * $this->baselineO;
5350 $obaseline = $glyphYorigin - $this->textparam[
'o-decoration'][
'baseline'] / $shrin_k;
5351 $olw = $this->LineWidth;
5352 $sub .=
' ' . (sprintf(
' %.3F w 0 j 0 J ',
$ut * Mpdf::SCALE));
5353 $sub .=
' ' . $this->_dounderline($this->x + $dx, $this->y + $obaseline + $adjusty, $txt, $OTLdata, $textvar);
5354 $sub .=
' ' . (sprintf(
' %.3F w 2 j 2 J ', $olw * Mpdf::SCALE));
5355 if ($this->FillColor != $c) {
5356 $sub .=
' ' . $this->FillColor .
' ';
5361 if ($this->textshadow) {
5362 foreach ($this->textshadow as $ts) {
5364 $s .= $this->SetTColor($ts[
'col'],
true) .
"\n";
5365 if ($ts[
'col'][0] == 5 && ord($ts[
'col'][4]) < 100) {
5366 $s .= $this->SetAlpha(ord($ts[
'col'][4]) / 100,
'Normal',
true,
'F') .
"\n";
5367 } elseif ($ts[
'col'][0] == 6 && ord($ts[
'col'][5]) < 100) {
5368 $s .= $this->SetAlpha(ord($ts[
'col'][5]) / 100,
'Normal',
true,
'F') .
"\n";
5369 } elseif ($ts[
'col'][0] == 1 && $ts[
'col'][2] == 1 && ord($ts[
'col'][3]) < 100) {
5370 $s .= $this->SetAlpha(ord($ts[
'col'][3]) / 100,
'Normal',
true,
'F') .
"\n";
5372 $s .= sprintf(
' 1 0 0 1 %.4F %.4F cm', $ts[
'x'] * Mpdf::SCALE, -$ts[
'y'] * Mpdf::SCALE) .
"\n";
5381 if ($this->ColorFlag) {
5387 $this->
Link($this->x, $boxtop, $w, $boxheight, $link);
5391 $this->writer->write($s);
5395 if ($this->ws && !$this->usingCoreFont) {
5396 $this->writer->write(sprintf(
'BT %.3F Tc ET', $this->charspacing));
5399 if (strpos($txt,
"\n") !==
false) {
5407 if ($currentx != 0) {
5408 $this->x = $currentx;
5410 $this->x = $this->lMargin;
5422 if ((isset($this->CurrentFont[
'sip']) && $this->CurrentFont[
'sip']) || (isset($this->CurrentFont[
'smp']) && $this->CurrentFont[
'smp'])) {
5436 $fontid = $last_fontid = $original_fontid = $this->CurrentFont[
'subsetfontids'][0];
5438 $fontid = $last_fontid = $original_fontid = $this->CurrentFont[
'i'];
5440 $SmallCapsON =
false;
5441 $lastSmallCapsON =
false;
5442 $last_fontsize = $fontsize = $this->FontSizePt;
5443 $last_fontstretch = $fontstretch = 100;
5444 $groupBreak =
false;
5446 $unicode = $this->UTF8StringToArray($txt);
5448 $GPOSinfo = (isset($OTLdata[
'GPOSinfo']) ? $OTLdata[
'GPOSinfo'] : []);
5449 $charspacing = ($this->charspacing * 1000 / $this->FontSizePt);
5450 $wordspacing = ($this->ws * 1000 / $this->FontSizePt);
5454 $lastYPlacement = 0;
5465 for ($i = 0; $i < count($unicode); $i++) {
5468 $XshiftBefore = $XshiftAfter;
5471 $groupBreak =
false;
5473 if (!empty($OTLdata)) {
5475 if (isset($GPOSinfo[$i][
'YPlacement']) && $GPOSinfo[$i][
'YPlacement']) {
5476 $YPlacement = $GPOSinfo[$i][
'YPlacement'] * $this->FontSizePt / $this->CurrentFont[
'unitsPerEm'];
5480 if (isset($GPOSinfo[$i][
'XPlacement']) && $GPOSinfo[$i][
'XPlacement']) {
5481 if (!isset($GPOSinfo[$i][
'wDir']) || $GPOSinfo[$i][
'wDir'] !=
'RTL') {
5482 if (isset($GPOSinfo[$i][
'BaseWidth'])) {
5483 $GPOSinfo[$i][
'XPlacement'] -= $GPOSinfo[$i][
'BaseWidth'];
5488 $XshiftBefore += $GPOSinfo[$i][
'XPlacement'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
5489 $XshiftAfter += -$GPOSinfo[$i][
'XPlacement'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
5495 if (isset($GPOSinfo[$i][
'kashida_space']) && $GPOSinfo[$i][
'kashida_space']) {
5496 $kashida = $GPOSinfo[$i][
'kashida_space'];
5500 $XshiftAfter += $wordspacing;
5503 if (substr($OTLdata[
'group'], ($i + 1), 1) !=
'M') {
5504 $XshiftAfter += $charspacing;
5509 if (((isset($GPOSinfo[$i][
'wDir']) && $GPOSinfo[$i][
'wDir'] !=
'RTL') || !isset($GPOSinfo[$i][
'wDir'])) && isset($GPOSinfo[$i][
'XAdvanceL']) && $GPOSinfo[$i][
'XAdvanceL']) {
5510 $XshiftAfter += $GPOSinfo[$i][
'XAdvanceL'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
5511 } elseif (isset($GPOSinfo[$i][
'wDir']) && $GPOSinfo[$i][
'wDir'] ==
'RTL' && isset($GPOSinfo[$i][
'XAdvanceR']) && $GPOSinfo[$i][
'XAdvanceR']) {
5512 $XshiftAfter += $GPOSinfo[$i][
'XAdvanceR'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
5516 $XshiftAfter += $charspacing;
5518 $XshiftAfter += $wordspacing;
5524 if ($i > 0 && isset($this->CurrentFont[
'kerninfo'][$unicode[($i - 1)]][$unicode[$i]])) {
5525 $XshiftBefore += $this->CurrentFont[
'kerninfo'][$unicode[($i - 1)]][$unicode[$i]];
5529 if ($YPlacement != $lastYPlacement) {
5533 if ($XshiftBefore) {
5535 $XshiftBefore *= 100 / $last_fontstretch;
5537 $tj .= sprintf(
'>%d<', (-$XshiftBefore));
5539 $tj .= sprintf(
')%d(', (-$XshiftBefore));
5545 if (isset($this->upperCase[$c])) {
5546 $c = $this->upperCase[$c];
5548 $SmallCapsON =
true;
5550 if (!$lastSmallCapsON) {
5552 $fontstretch = $this->smCapsStretch;
5553 $fontsize = $this->FontSizePt * $this->smCapsScale;
5556 $SmallCapsON =
false;
5557 if ($lastSmallCapsON) {
5560 $fontsize = $this->FontSizePt;
5577 for ($j = 0; $j < 99; $j++) {
5578 $init = array_search($c, $this->CurrentFont[
'subsets'][$j]);
5579 if ($init !==
false) {
5580 if ($this->CurrentFont[
'subsetfontids'][$j] != $last_fontid) {
5582 $fontid = $this->CurrentFont[
'subsetfontids'][$j];
5584 $tx = sprintf(
"%02s", strtoupper(dechex($init)));
5586 } elseif (count($this->CurrentFont[
'subsets'][$j]) < 255) {
5587 $n = count($this->CurrentFont[
'subsets'][$j]);
5588 $this->CurrentFont[
'subsets'][$j][$n] = $c;
5589 if ($this->CurrentFont[
'subsetfontids'][$j] != $last_fontid) {
5591 $fontid = $this->CurrentFont[
'subsetfontids'][$j];
5593 $tx = sprintf(
"%02s", strtoupper(dechex($n)));
5595 } elseif (!isset($this->CurrentFont[
'subsets'][($j + 1)])) {
5596 $this->CurrentFont[
'subsets'][($j + 1)] = [0 => 0];
5597 $this->CurrentFont[
'subsetfontids'][($j + 1)] = count($this->fonts) + $this->extraFontSubsets + 1;
5598 $this->extraFontSubsets++;
5603 if ($this->usingCoreFont) {
5604 $tx = utf8_decode($tx);
5606 $tx = $this->writer->utf8ToUtf16BigEndian($tx,
false);
5608 $tx = $this->writer->escape($tx);
5612 if ($groupBreak || $fontstretch != $last_fontstretch) {
5618 if ($fontid != $last_fontid || $fontsize != $last_fontsize) {
5619 $tj .= sprintf(
' /F%d %.3F Tf ', $fontid, $fontsize);
5621 if ($fontstretch != $last_fontstretch) {
5622 $tj .= sprintf(
'%d Tz ', $fontstretch);
5624 if ($YPlacement != $lastYPlacement) {
5625 $tj .= sprintf(
'%.3F Ts ', $YPlacement);
5636 $lastSmallCapsON = $SmallCapsON;
5637 $last_fontid = $fontid;
5638 $last_fontsize = $fontsize;
5639 $last_fontstretch = $fontstretch;
5644 if (isset($this->CurrentFont[
'subset'])) {
5645 $this->CurrentFont[
'subset'][$c] = $c;
5647 $kashida *= 1000 / $this->FontSizePt;
5648 $tatw = $this->_getCharWidth($this->CurrentFont[
'cw'], 0x0640);
5652 while ($OTLdata[
'group'][$nextbase] !=
'C') {
5655 if (isset($GPOSinfo[$nextbase]) && isset($GPOSinfo[$nextbase][
'YPlacement']) && $GPOSinfo[$nextbase][
'YPlacement']) {
5656 $YPlacement = $GPOSinfo[$nextbase][
'YPlacement'] * $this->FontSizePt / $this->CurrentFont[
'unitsPerEm'];
5661 for ($j = 0; $j < 99; $j++) {
5662 $init = array_search($c, $this->CurrentFont[
'subsets'][$j]);
5663 if ($init !==
false) {
5664 if ($this->CurrentFont[
'subsetfontids'][$j] != $last_fontid) {
5665 $fontid = $this->CurrentFont[
'subsetfontids'][$j];
5667 $tx = sprintf(
"%02s", strtoupper(dechex($init)));
5669 } elseif (count($this->CurrentFont[
'subsets'][$j]) < 255) {
5670 $n = count($this->CurrentFont[
'subsets'][$j]);
5671 $this->CurrentFont[
'subsets'][$j][$n] = $c;
5672 if ($this->CurrentFont[
'subsetfontids'][$j] != $last_fontid) {
5673 $fontid = $this->CurrentFont[
'subsetfontids'][$j];
5675 $tx = sprintf(
"%02s", strtoupper(dechex($n)));
5677 } elseif (!isset($this->CurrentFont[
'subsets'][($j + 1)])) {
5678 $this->CurrentFont[
'subsets'][($j + 1)] = [0 => 0];
5679 $this->CurrentFont[
'subsetfontids'][($j + 1)] = count($this->fonts) + $this->extraFontSubsets + 1;
5680 $this->extraFontSubsets++;
5685 $tx = $this->writer->utf8ToUtf16BigEndian($tx,
false);
5686 $tx = $this->writer->escape($tx);
5689 if ($kashida > $tatw) {
5692 $nt = intval($kashida / $tatw);
5693 $nudgeback = (($nt + 1) * $tatw) - $kashida;
5694 $optx = str_repeat($tx, $nt);
5696 $optx .= sprintf(
'>%d<', ($nudgeback));
5698 $optx .= sprintf(
')%d(', ($nudgeback));
5703 $fontstretch = ($kashida / $tatw) * 100;
5712 if ($fontid != $last_fontid || $fontsize != $last_fontsize) {
5713 $tj .= sprintf(
' /F%d %.3F Tf ', $fontid, $fontsize);
5715 if ($fontstretch != $last_fontstretch) {
5716 $tj .= sprintf(
'%d Tz ', $fontstretch);
5718 $tj .= sprintf(
'%.3F Ts ', $YPlacement);
5727 $last_fontid = $fontid;
5728 $last_fontstretch = $fontstretch;
5732 $lastYPlacement = $YPlacement;
5740 $tj .= sprintf(
'%d', (-$XshiftAfter));
5742 if ($last_fontid != $original_fontid) {
5744 $tj .= sprintf(
' /F%d %.3F Tf ', $original_fontid, $fontsize);
5747 $tj = preg_replace(
'/([^\\\])<>/',
'\\1 ', $tj);
5751 $tj .= sprintf(
'%d', (-$XshiftAfter));
5753 if ($last_fontid != $original_fontid) {
5755 $tj .= sprintf(
' /F%d %.3F Tf ', $original_fontid, $fontsize);
5758 $tj = preg_replace(
'/([^\\\])\(\)/',
'\\1 ', $tj);
5761 $s = sprintf(
' BT ' . $aix .
' 0 Tc 0 Tw [%s] TJ ET ', $x, $y, $tj);
5768 function _kern($txt, $mode, $aix, $x, $y)
5770 if ($mode ==
'MBTw') {
5773 $space = $this->writer->utf8ToUtf16BigEndian($space,
false);
5774 $space = $this->writer->escape($space);
5775 $s = sprintf(
' BT ' . $aix, $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE);
5776 $t = explode(
' ', $txt);
5777 for ($i = 0; $i < count($t); $i++) {
5781 $unicode = $this->UTF8StringToArray($tx);
5782 for ($ti = 0; $ti < count($unicode); $ti++) {
5783 if ($ti > 0 && isset($this->CurrentFont[
'kerninfo'][$unicode[($ti - 1)]][$unicode[$ti]])) {
5784 $kern = -$this->CurrentFont[
'kerninfo'][$unicode[($ti - 1)]][$unicode[$ti]];
5785 $tj .= sprintf(
')%d(', $kern);
5788 $tc = $this->writer->utf8ToUtf16BigEndian($tc,
false);
5789 $tj .= $this->writer->escape($tc);
5792 $s .= sprintf(
' %.3F Tc [%s] TJ', $this->charspacing, $tj);
5795 if (($i + 1) < count($t)) {
5796 $s .= sprintf(
' %.3F Tc (%s) Tj', $this->ws + $this->charspacing, $space);
5800 } elseif (!$this->usingCoreFont) {
5803 $unicode = $this->UTF8StringToArray($txt);
5804 for ($i = 0; $i < count($unicode); $i++) {
5805 if ($i > 0 && isset($this->CurrentFont[
'kerninfo'][$unicode[($i - 1)]][$unicode[$i]])) {
5806 $kern = -$this->CurrentFont[
'kerninfo'][$unicode[($i - 1)]][$unicode[$i]];
5807 $tj .= sprintf(
')%d(', $kern);
5810 $tx = $this->writer->utf8ToUtf16BigEndian($tx,
false);
5811 $tj .= $this->writer->escape($tx);
5814 $s .= sprintf(
' BT ' . $aix .
' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
5819 for ($i = 0; $i < $l; $i++) {
5820 if ($i > 0 && isset($this->CurrentFont[
'kerninfo'][$txt[($i - 1)]][$txt[$i]])) {
5821 $kern = -$this->CurrentFont[
'kerninfo'][$txt[($i - 1)]][$txt[$i]];
5822 $tj .= sprintf(
')%d(', $kern);
5824 $tj .= $this->writer->escape($txt[$i]);
5827 $s .= sprintf(
' BT ' . $aix .
' [%s] TJ ET ', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $tj);
5841 $directionality =
'ltr',
5851 $txt = $this->purify_utf8_text($txt);
5853 if ($this->text_input_as_HTML) {
5854 $txt = $this->all_entities_to_utf8($txt);
5857 if ($this->usingCoreFont) {
5858 $txt = mb_convert_encoding($txt, $this->mb_enc,
'UTF-8');
5861 if (preg_match(
"/([" . $this->pregRTLchars .
"])/u", $txt)) {
5862 $this->biDirectional =
true;
5866 if (!is_array($OTLdata)) {
5871 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
5872 $txt = $this->otl->applyOTL($txt, $this->CurrentFont[
'useOTL']);
5873 $OTLdata = $this->otl->OTLdata;
5876 if ($directionality ==
'rtl' || $this->biDirectional) {
5877 if (!isset($OTLdata)) {
5878 $unicode = $this->UTF8StringToArray($txt,
false);
5880 $this->getBasicOTLdata($OTLdata, $unicode, $is_strong);
5887 $align = $this->defaultAlign;
5891 $cw = &$this->CurrentFont[
'cw'];
5894 $w = $this->w - $this->rMargin - $this->x;
5897 $wmax = ($w - ($this->cMarginL + $this->cMarginR));
5899 if ($this->usingCoreFont) {
5900 $s = str_replace(
"\r",
'', $txt);
5902 while ($nb > 0 and $s[$nb - 1] ==
"\n") {
5906 $s = str_replace(
"\r",
'', $txt);
5907 $nb = mb_strlen($s, $this->mb_enc);
5908 while ($nb > 0 and mb_substr($s, $nb - 1, 1, $this->mb_enc) ==
"\n") {
5923 if (is_int(strpos($border,
'L'))) {
5926 if (is_int(strpos($border,
'R'))) {
5929 $b = is_int(strpos($border,
'T')) ? $b2 .
'T' : $b2;
5941 $start_y = $this->y;
5943 if (!$this->usingCoreFont) {
5945 $inclCursive =
false;
5947 if (preg_match(
"/([" . $this->pregCURSchars .
"])/u", $s)) {
5948 $inclCursive =
true;
5954 $c = mb_substr($s, $i, 1, $this->mb_enc);
5959 $this->ResetSpacing();
5960 $tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mb_enc));
5961 $tmpOTLdata =
false;
5964 if (isset($OTLdata)) {
5965 $tmpOTLdata = $this->otl->sliceOTLdata($OTLdata, $j, $i - $j);
5966 $this->otl->trimOTLdata($tmpOTLdata,
false,
true);
5967 $this->magic_reverse_dir($tmp, $directionality, $tmpOTLdata);
5971 $this->Cell($w, $h, $tmp, $b, 2, $align, $fill, $link, 0, 0, 0,
'M', 0,
false, $tmpOTLdata);
5973 if ($maxrows !=
false && isset($this->form) && ($this->y - $start_y) / $h > $maxrows) {
5984 if ($border and $nl == 2) {
5997 $l += $this->GetCharWidthNonCore($c);
6009 $this->ResetSpacing();
6010 $tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mb_enc));
6011 $tmpOTLdata =
false;
6014 if (isset($OTLdata)) {
6015 $tmpOTLdata = $this->otl->sliceOTLdata($OTLdata, $j, $i - $j);
6016 $this->otl->trimOTLdata($tmpOTLdata,
false,
true);
6017 $this->magic_reverse_dir($tmp, $directionality, $tmpOTLdata);
6021 $this->Cell($w, $h, $tmp, $b, 2, $align, $fill, $link, 0, 0, 0,
'M', 0,
false, $tmpOTLdata);
6025 $tmp = rtrim(mb_substr($s, $j, $sep - $j, $this->mb_enc));
6026 $tmpOTLdata =
false;
6029 if (isset($OTLdata)) {
6030 $tmpOTLdata = $this->otl->sliceOTLdata($OTLdata, $j, $sep - $j);
6031 $this->otl->trimOTLdata($tmpOTLdata,
false,
true);
6035 if ($align ===
'J') {
6041 $tmp = str_replace(chr(194) . chr(160), chr(32), $tmp);
6042 $len_ligne = $this->GetStringWidth($tmp,
false, $tmpOTLdata);
6043 $nb_carac = mb_strlen($tmp, $this->mb_enc);
6044 $nb_spaces = mb_substr_count($tmp,
' ', $this->mb_enc);
6049 if (isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'])) {
6050 if (isset($tmpOTLdata[
'group']) && $tmpOTLdata[
'group']) {
6051 $nb_carac -= substr_count($tmpOTLdata[
'group'],
'M');
6055 list($charspacing, $ws, $kashida) = $this->GetJspacing($nb_carac, $nb_spaces, ((($wmax) - $len_ligne) * Mpdf::SCALE), $inclCursive, $tmpOTLdata);
6056 $this->SetSpacing($charspacing, $ws);
6059 if (isset($OTLdata)) {
6060 $this->magic_reverse_dir($tmp, $directionality, $tmpOTLdata);
6063 $this->Cell($w, $h, $tmp, $b, 2, $align, $fill, $link, 0, 0, 0,
'M', 0,
false, $tmpOTLdata);
6068 if ($maxrows !=
false && isset($this->form) && ($this->y - $start_y) / $h > $maxrows) {
6078 if ($border and $nl == 2) {
6090 $this->ResetSpacing();
6103 $this->ResetSpacing();
6104 $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill, $link);
6106 if ($maxrows !=
false && isset($this->form) && ($this->y - $start_y) / $h > $maxrows) {
6117 if ($border and $nl == 2) {
6130 $l += $this->GetCharWidthCore($c);
6142 $this->ResetSpacing();
6143 $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill, $link);
6147 if ($align ===
'J') {
6149 $tmp = rtrim(substr($s, $j, $sep - $j));
6155 $tmp = str_replace(chr(160), chr(32), $tmp);
6156 $len_ligne = $this->GetStringWidth($tmp);
6157 $nb_carac = strlen($tmp);
6158 $nb_spaces = substr_count($tmp,
' ');
6161 list($charspacing, $ws, $kashida) = $this->GetJspacing($nb_carac, $nb_spaces, ((($wmax) - $len_ligne) * Mpdf::SCALE),
false, $tmpOTLdata);
6162 $this->SetSpacing($charspacing, $ws);
6165 $this->Cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill, $link);
6169 if ($maxrows !=
false && isset($this->form) && ($this->y - $start_y) / $h > $maxrows) {
6179 if ($border and $nl == 2) {
6191 $this->ResetSpacing();
6195 if ($border and is_int(strpos($border,
'B'))) {
6199 if (!$this->usingCoreFont) {
6201 $tmp = rtrim(mb_substr($s, $j, $i - $j, $this->mb_enc));
6202 $tmpOTLdata =
false;
6205 if (isset($OTLdata)) {
6206 $tmpOTLdata = $this->otl->sliceOTLdata($OTLdata, $j, $i - $j);
6207 $this->otl->trimOTLdata($tmpOTLdata,
false,
true);
6208 $this->magic_reverse_dir($tmp, $directionality, $tmpOTLdata);
6212 $this->Cell($w, $h, $tmp, $b, 2, $align, $fill, $link, 0, 0, 0,
'M', 0,
false, $tmpOTLdata);
6214 $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill, $link);
6217 $this->x = $this->lMargin;
6222 function Write($h, $txt, $currentx = 0, $link =
'', $directionality =
'ltr', $align =
'', $fill = 0)
6224 if (empty($this->directWrite)) {
6225 $this->directWrite =
new DirectWrite($this, $this->otl, $this->sizeConverter, $this->colorConverter);
6228 $this->directWrite->Write($h, $txt, $currentx, $link, $directionality, $align, $fill);
6239 $saved[
'family'] = $this->FontFamily;
6240 $saved[
'style'] = $this->FontStyle;
6241 $saved[
'sizePt'] = $this->FontSizePt;
6242 $saved[
'size'] = $this->FontSize;
6243 $saved[
'HREF'] = $this->HREF;
6244 $saved[
'textvar'] = $this->textvar;
6245 $saved[
'OTLtags'] = $this->OTLtags;
6246 $saved[
'textshadow'] = $this->textshadow;
6247 $saved[
'linewidth'] = $this->LineWidth;
6248 $saved[
'drawcolor'] = $this->DrawColor;
6249 $saved[
'textparam'] = $this->textparam;
6250 $saved[
'lSpacingCSS'] = $this->lSpacingCSS;
6251 $saved[
'wSpacingCSS'] = $this->wSpacingCSS;
6252 $saved[
'I'] = $this->I;
6253 $saved[
'B'] = $this->B;
6254 $saved[
'colorarray'] = $this->colorarray;
6255 $saved[
'bgcolorarray'] = $this->spanbgcolorarray;
6256 $saved[
'border'] = $this->spanborddet;
6257 $saved[
'color'] = $this->TextColor;
6258 $saved[
'bgcolor'] = $this->FillColor;
6259 $saved[
'lang'] = $this->currentLang;
6260 $saved[
'fontLanguageOverride'] = $this->fontLanguageOverride;
6261 $saved[
'display_off'] = $this->inlineDisplayOff;
6268 $FontFamily = $saved[
'family'];
6269 $this->FontStyle = $saved[
'style'];
6270 $this->FontSizePt = $saved[
'sizePt'];
6271 $this->FontSize = $saved[
'size'];
6273 $this->currentLang = $saved[
'lang'];
6274 $this->fontLanguageOverride = $saved[
'fontLanguageOverride'];
6276 $this->ColorFlag = ($this->FillColor != $this->TextColor);
6278 $this->HREF = $saved[
'HREF'];
6279 $this->textvar = $saved[
'textvar'];
6280 $this->OTLtags = $saved[
'OTLtags'];
6281 $this->textshadow = $saved[
'textshadow'];
6282 $this->LineWidth = $saved[
'linewidth'];
6283 $this->DrawColor = $saved[
'drawcolor'];
6284 $this->textparam = $saved[
'textparam'];
6285 $this->inlineDisplayOff = $saved[
'display_off'];
6287 $this->lSpacingCSS = $saved[
'lSpacingCSS'];
6288 if (($this->lSpacingCSS || $this->lSpacingCSS ===
'0') && strtoupper($this->lSpacingCSS) !=
'NORMAL') {
6289 $this->fixedlSpacing = $this->sizeConverter->convert($this->lSpacingCSS, $this->FontSize);
6291 $this->fixedlSpacing =
false;
6293 $this->wSpacingCSS = $saved[
'wSpacingCSS'];
6294 if ($this->wSpacingCSS && strtoupper($this->wSpacingCSS) !=
'NORMAL') {
6295 $this->minwSpacing = $this->sizeConverter->convert($this->wSpacingCSS, $this->FontSize);
6297 $this->minwSpacing = 0;
6300 $this->
SetFont($FontFamily, $saved[
'style'], $saved[
'sizePt'],
false);
6302 $this->currentfontstyle = $saved[
'style'];
6303 $this->currentfontsize = $saved[
'sizePt'];
6304 $this->SetStylesArray([
'B' => $saved[
'B'],
'I' => $saved[
'I']]);
6306 $this->TextColor = $saved[
'color'];
6307 $this->FillColor = $saved[
'bgcolor'];
6308 $this->colorarray = $saved[
'colorarray'];
6309 $cor = $saved[
'colorarray'];
6311 $this->SetTColor($cor);
6313 $this->spanbgcolorarray = $saved[
'bgcolorarray'];
6314 $cor = $saved[
'bgcolorarray'];
6316 $this->SetFColor($cor);
6318 $this->spanborddet = $saved[
'border'];
6326 for ($i = 1; $i <= $this->blklvl; $i++) {
6327 if ($this->blk[$i][
'bgcolor'] || $this->blk[$i][
'border_left'][
'w'] || $this->blk[$i][
'border_right'][
'w'] || $this->blk[$i][
'border_top'][
'w'] || $this->blk[$i][
'border_bottom'][
'w']) {
6342 $saved[
'family'] = $this->FontFamily;
6343 $saved[
'style'] = $this->FontStyle;
6344 $saved[
'sizePt'] = $this->FontSizePt;
6345 $saved[
'size'] = $this->FontSize;
6346 $saved[
'curr'] = &$this->CurrentFont;
6347 $saved[
'lang'] = $this->currentLang;
6348 $saved[
'color'] = $this->TextColor;
6349 $saved[
'spanbgcolor'] = $this->spanbgcolor;
6350 $saved[
'spanbgcolorarray'] = $this->spanbgcolorarray;
6351 $saved[
'bord'] = $this->spanborder;
6352 $saved[
'border'] = $this->spanborddet;
6353 $saved[
'HREF'] = $this->HREF;
6354 $saved[
'textvar'] = $this->textvar;
6355 $saved[
'textshadow'] = $this->textshadow;
6356 $saved[
'linewidth'] = $this->LineWidth;
6357 $saved[
'drawcolor'] = $this->DrawColor;
6358 $saved[
'textparam'] = $this->textparam;
6359 $saved[
'ReqFontStyle'] = $this->ReqFontStyle;
6360 $saved[
'fixedlSpacing'] = $this->fixedlSpacing;
6361 $saved[
'minwSpacing'] = $this->minwSpacing;
6367 if (!isset($saved) || empty($saved)) {
6371 $this->FontFamily = $saved[
'family'];
6372 $this->FontStyle = $saved[
'style'];
6373 $this->FontSizePt = $saved[
'sizePt'];
6374 $this->FontSize = $saved[
'size'];
6375 $this->CurrentFont = &$saved[
'curr'];
6376 $this->currentLang = $saved[
'lang'];
6377 $this->TextColor = $saved[
'color'];
6378 $this->spanbgcolor = $saved[
'spanbgcolor'];
6379 $this->spanbgcolorarray = $saved[
'spanbgcolorarray'];
6380 $this->spanborder = $saved[
'bord'];
6381 $this->spanborddet = $saved[
'border'];
6382 $this->ColorFlag = ($this->FillColor != $this->TextColor);
6383 $this->HREF = $saved[
'HREF'];
6384 $this->fixedlSpacing = $saved[
'fixedlSpacing'];
6385 $this->minwSpacing = $saved[
'minwSpacing'];
6386 $this->textvar = $saved[
'textvar'];
6387 $this->textshadow = $saved[
'textshadow'];
6388 $this->LineWidth = $saved[
'linewidth'];
6389 $this->DrawColor = $saved[
'drawcolor'];
6390 $this->textparam = $saved[
'textparam'];
6392 $this->
SetFont($saved[
'family'], $saved[
'style'], $saved[
'sizePt'],
true,
true);
6393 $fontout = (sprintf(
'BT /F%d %.3F Tf ET', $this->CurrentFont[
'i'], $this->FontSizePt));
6394 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'Font']) && $this->pageoutput[$this->page][
'Font'] != $fontout) || !isset($this->pageoutput[$this->page][
'Font']))) {
6395 $this->writer->write($fontout);
6397 $this->pageoutput[$this->page][
'Font'] = $fontout;
6399 $this->
SetFont($saved[
'family'], $saved[
'style'], $saved[
'sizePt'],
false);
6401 $this->ReqFontStyle = $saved[
'ReqFontStyle'];
6404 function newFlowingBlock($w, $h, $a =
'', $is_table =
false, $blockstate = 0, $newblock =
true, $blockdir =
'ltr', $table_draft =
false)
6407 if ($blockdir ==
'rtl') {
6413 $this->flowingBlockAttr[
'width'] = ($w * Mpdf::SCALE);
6415 $this->flowingBlockAttr[
'is_table'] = $is_table;
6416 $this->flowingBlockAttr[
'table_draft'] = $table_draft;
6417 $this->flowingBlockAttr[
'height'] = $h;
6418 $this->flowingBlockAttr[
'lineCount'] = 0;
6419 $this->flowingBlockAttr[
'align'] = $a;
6420 $this->flowingBlockAttr[
'font'] = [];
6421 $this->flowingBlockAttr[
'content'] = [];
6422 $this->flowingBlockAttr[
'contentB'] = [];
6423 $this->flowingBlockAttr[
'contentWidth'] = 0;
6424 $this->flowingBlockAttr[
'blockstate'] = $blockstate;
6426 $this->flowingBlockAttr[
'newblock'] = $newblock;
6427 $this->flowingBlockAttr[
'valign'] =
'M';
6428 $this->flowingBlockAttr[
'blockdir'] = $blockdir;
6429 $this->flowingBlockAttr[
'cOTLdata'] = [];
6430 $this->flowingBlockAttr[
'lastBidiText'] =
'';
6431 if (!empty($this->otl)) {
6432 $this->otl->lastBidiStrongType =
'';
6438 $currentx = $this->x;
6440 $is_table = $this->flowingBlockAttr[
'is_table'];
6441 $table_draft = $this->flowingBlockAttr[
'table_draft'];
6442 $maxWidth = & $this->flowingBlockAttr[
'width'];
6443 $stackHeight = & $this->flowingBlockAttr[
'height'];
6444 $align = & $this->flowingBlockAttr[
'align'];
6445 $content = & $this->flowingBlockAttr[
'content'];
6446 $contentB = & $this->flowingBlockAttr[
'contentB'];
6447 $font = & $this->flowingBlockAttr[
'font'];
6448 $contentWidth = & $this->flowingBlockAttr[
'contentWidth'];
6449 $lineCount = & $this->flowingBlockAttr[
'lineCount'];
6450 $valign = & $this->flowingBlockAttr[
'valign'];
6451 $blockstate = $this->flowingBlockAttr[
'blockstate'];
6453 $cOTLdata = & $this->flowingBlockAttr[
'cOTLdata'];
6454 $newblock = $this->flowingBlockAttr[
'newblock'];
6455 $blockdir = $this->flowingBlockAttr[
'blockdir'];
6458 if ($this->blk[$this->blklvl][
'bgcolor'] && !$is_table) {
6461 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
6468 if (isset($content[count($content) - 1]) && preg_match(
'/[ ]+$/', $content[count($content) - 1], $m)) {
6469 $strip = strlen($m[0]);
6470 $content[count($content) - 1] = substr($content[count($content) - 1], 0, (strlen($content[count($content) - 1]) - $strip));
6472 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
6473 $this->otl->trimOTLdata($cOTLdata[count($cOTLdata) - 1],
false,
true);
6482 $oldcolumn = $this->CurrCol;
6484 if ($this->ColActive && !$is_table) {
6485 $this->breakpoints[$this->CurrCol][] = $this->y;
6497 $ipaddingL = $this->blk[$this->blklvl][
'padding_left'];
6498 $ipaddingR = $this->blk[$this->blklvl][
'padding_right'];
6499 $paddingL = ($ipaddingL * Mpdf::SCALE);
6500 $paddingR = ($ipaddingR * Mpdf::SCALE);
6501 $this->cMarginL = $this->blk[$this->blklvl][
'border_left'][
'w'];
6502 $this->cMarginR = $this->blk[$this->blklvl][
'border_right'][
'w'];
6508 if (count($this->floatDivs)) {
6509 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($this->blklvl);
6511 $fpaddingR = $r_width;
6514 $fpaddingL = $l_width;
6519 $usey = $this->y + 0.002;
6520 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 0)) {
6521 $usey += $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'];
6525 if (isset($this->floatmargins[
'R']) && $usey <= $this->floatmargins[
'R'][
'y1'] && $usey >= $this->floatmargins[
'R'][
'y0'] && !$this->floatmargins[
'R'][
'skipline']) {
6526 $fpaddingR += $this->floatmargins[
'R'][
'w'];
6528 if (isset($this->floatmargins[
'L']) && $usey <= $this->floatmargins[
'L'][
'y1'] && $usey >= $this->floatmargins[
'L'][
'y0'] && !$this->floatmargins[
'L'][
'skipline']) {
6529 $fpaddingL += $this->floatmargins[
'L'][
'w'];
6537 $this->_setInlineBlockHeights($lineBox, $stackHeight, $content, $font, $is_table);
6539 if ($is_table && count($content) == 0) {
6544 $this->y += $stackHeight;
6545 $this->objectbuffer = [];
6554 foreach ($content as $k => $chunk) {
6555 $this->restoreFont($font[$k],
false);
6556 if (!isset($this->objectbuffer[$k]) || (isset($this->objectbuffer[$k]) && !$this->objectbuffer[$k])) {
6558 if (!$this->usingCoreFont) {
6561 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
6562 $this->otl->removeChar($chunk, $cOTLdata[$k],
"\xc2\xad");
6563 $this->otl->replaceSpace($chunk, $cOTLdata[$k]);
6564 $content[$k] = $chunk;
6566 $content[$k] = $chunk = str_replace(
"\xc2\xad",
'', $chunk);
6567 $content[$k] = $chunk = str_replace(chr(194) . chr(160), chr(32), $chunk);
6569 } elseif ($this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats') {
6570 $content[$k] = $chunk = str_replace(chr(173),
'', $chunk);
6571 $content[$k] = $chunk = str_replace(chr(160), chr(32), $chunk);
6573 $contentWidth += $this->GetStringWidth($chunk,
true, (isset($cOTLdata[$k]) ? $cOTLdata[$k] :
false), $this->textvar) * Mpdf::SCALE;
6574 } elseif (isset($this->objectbuffer[$k]) && $this->objectbuffer[$k]) {
6576 if ($this->objectbuffer[$k][
'type'] ==
'image' && isset($this->objectbuffer[$k][
'listmarker']) && $this->objectbuffer[$k][
'listmarker'] && $this->objectbuffer[$k][
'listmarkerposition'] ==
'outside') {
6579 $contentWidth += $this->objectbuffer[$k][
'OUTER-WIDTH'] * Mpdf::SCALE;
6584 if (isset($font[count($font) - 1])) {
6585 $lastfontreqstyle = (isset($font[count($font) - 1][
'ReqFontStyle']) ? $font[count($font) - 1][
'ReqFontStyle'] :
'');
6586 $lastfontstyle = (isset($font[count($font) - 1][
'style']) ? $font[count($font) - 1][
'style'] :
'');
6588 $lastfontreqstyle =
null;
6589 $lastfontstyle =
null;
6591 if ($blockdir ==
'ltr' && $lastfontreqstyle && strpos($lastfontreqstyle,
"I") !==
false && strpos($lastfontstyle,
"I") ===
false) {
6592 $lastitalic = $this->FontSize * 0.15 * Mpdf::SCALE;
6598 $check_h = max($this->divheight, $stackHeight);
6601 if ($endofblock && $newblock && $blockstate == 0 && !$content) {
6607 if ($this->blklvl > 0 && !$is_table) {
6608 if ($endofblock && $blockstate > 1) {
6609 if ($this->blk[$this->blklvl][
'page_break_after_avoid']) {
6610 $check_h += $stackHeight;
6612 $check_h += ($this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w']);
6614 if (($newblock && ($blockstate == 1 || $blockstate == 3) && $lineCount == 0) || ($endofblock && $blockstate == 3 && $lineCount == 0)) {
6615 $check_h += ($this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'border_top'][
'w']);
6620 if ($this->ColActive && $check_h > ($this->PageBreakTrigger - $this->y0)) {
6621 $this->SetCol($this->NbCol - 1);
6625 if ($endofblock && $blockstate > 1 && !$content) {
6626 $buff = $this->margBuffer;
6633 if (!$is_table && ($this->y + $check_h) > ($this->PageBreakTrigger + $buff) and ! $this->InFooter and $this->AcceptPageBreak()) {
6637 $charspacing = $this->charspacing;
6638 $this->ResetSpacing();
6640 $this->
AddPage($this->CurOrientation);
6644 $currentx += $this->MarginCorrection;
6645 $this->x += $this->MarginCorrection;
6648 $this->SetSpacing($charspacing, $ws);
6655 if ($this->CurrCol != $oldcolumn) {
6656 $currentx += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
6657 $this->x += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
6658 $oldcolumn = $this->CurrCol;
6662 if ($this->ColActive && !$is_table) {
6663 $this->breakpoints[$this->CurrCol][] = $this->y;
6668 if ($newblock && ($blockstate == 1 || $blockstate == 3) && ($this->blk[$this->blklvl][
'margin_top']) && $lineCount == 0 && !$is_table) {
6669 $this->DivLn($this->blk[$this->blklvl][
'margin_top'], $this->blklvl - 1,
true, $this->blk[$this->blklvl][
'margin_collapse']);
6670 if ($this->ColActive) {
6671 $this->breakpoints[$this->CurrCol][] = $this->y;
6675 if ($newblock && ($blockstate == 1 || $blockstate == 3) && $lineCount == 0 && !$is_table) {
6676 $this->blk[$this->blklvl][
'y0'] = $this->y;
6677 $this->blk[$this->blklvl][
'startpage'] = $this->page;
6678 if ($this->blk[$this->blklvl][
'float']) {
6679 $this->blk[$this->blklvl][
'float_start_y'] = $this->y;
6681 if ($this->ColActive) {
6682 $this->breakpoints[$this->CurrCol][] = $this->y;
6687 $WidthCorrection = 0;
6688 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && isset($this->blk[$this->blklvl][
'text_indent']) && ($lineCount == 0) && (!$is_table) && ($align !=
'C')) {
6689 $ti = $this->sizeConverter->convert($this->blk[$this->blklvl][
'text_indent'], $this->blk[$this->blklvl][
'inner_width'], $this->blk[$this->blklvl][
'InlineProperties'][
'size'],
false);
6690 $WidthCorrection = ($ti * Mpdf::SCALE);
6695 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && (($this->blk[$this->blklvl][
'padding_top']) || ($this->blk[$this->blklvl][
'border_top'])) && ($lineCount == 0) && (!$is_table)) {
6697 $this->DivLn($this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'], -3,
true,
false, 1);
6698 if ($this->ColActive) {
6699 $this->breakpoints[$this->CurrCol][] = $this->y;
6701 $this->x = $currentx;
6709 if (count($this->floatDivs)) {
6710 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($this->blklvl);
6712 $fpaddingR = $r_width;
6715 $fpaddingL = $l_width;
6720 $usey = $this->y + 0.002;
6721 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 0)) {
6722 $usey += $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'];
6726 if (isset($this->floatmargins[
'R']) && $usey <= $this->floatmargins[
'R'][
'y1'] && $usey >= $this->floatmargins[
'R'][
'y0'] && !$this->floatmargins[
'R'][
'skipline']) {
6727 $fpaddingR += $this->floatmargins[
'R'][
'w'];
6729 if (isset($this->floatmargins[
'L']) && $usey <= $this->floatmargins[
'L'][
'y1'] && $usey >= $this->floatmargins[
'L'][
'y0'] && !$this->floatmargins[
'L'][
'skipline']) {
6730 $fpaddingL += $this->floatmargins[
'L'][
'w'];
6744 $inclCursive =
false;
6746 foreach ($content as $k => $chunk) {
6747 if (!isset($this->objectbuffer[$k]) || (isset($this->objectbuffer[$k]) && !$this->objectbuffer[$k])) {
6748 $nb_carac += mb_strlen($chunk, $this->mb_enc);
6749 $nb_spaces += mb_substr_count($chunk,
' ', $this->mb_enc);
6752 $this->restoreFont($font[$k],
false);
6753 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
6754 if (isset($cOTLdata[$k][
'group']) && $cOTLdata[$k][
'group']) {
6755 $nb_marks = substr_count($cOTLdata[$k][
'group'],
'M');
6756 $nb_carac -= $nb_marks;
6758 if (preg_match(
"/([" . $this->pregCURSchars .
"])/u", $chunk)) {
6759 $inclCursive =
true;
6764 if ($this->objectbuffer[$k][
'type'] ==
'dottab') {
6765 $dottab = $this->objectbuffer[$k][
'outdent'];
6771 $chunkorder = range(0, count($content) - 1);
6774 if ($blockdir ==
'rtl' || $this->biDirectional) {
6775 $this->otl->bidiReorder($chunkorder, $content, $cOTLdata, $blockdir);
6784 foreach ($chunkorder as $aord => $k) {
6785 if (count($cOTLdata)) {
6786 $this->restoreFont($font[$k],
false);
6788 if ($aord == count($chunkorder) - 1 && isset($cOTLdata[$aord][
'group'])) {
6789 $nGPOS = strlen($cOTLdata[$aord][
'group']) - 1;
6790 if (isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL']) || isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'])) {
6791 if (isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'])) {
6792 $w = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
6794 $w = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
6796 $w *= ($this->FontSize / 1000);
6797 $contentWidth -= $w * Mpdf::SCALE;
6798 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'] = 0;
6799 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'] = 0;
6803 if (isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'])) {
6804 $w = -$cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
6805 $w *= ($this->FontSize / 1000);
6806 $contentWidth -= $w * Mpdf::SCALE;
6807 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'] = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'];
6808 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'] = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'];
6816 $lastchar = mb_substr($content[(count($chunkorder) - 1)], mb_strlen($content[(count($chunkorder) - 1)], $this->mb_enc) - 1, 1, $this->mb_enc);
6817 if (preg_match(
"/[" . $this->CJKoverflow .
"]/u", $lastchar)) {
6818 $CJKoverflow =
true;
6820 $CJKoverflow =
false;
6822 if ((((($contentWidth + $lastitalic) > $maxWidth) && ($content[(count($chunkorder) - 1)] !=
' ') ) ||
6823 (!$endofblock && $align ==
'J' && ($next ==
'image' || $next ==
'select' || $next ==
'input' || $next ==
'textarea' || ($next ==
'br' && $this->justifyB4br)))) && !($CJKoverflow && $this->allowCJKoverflow)) {
6825 list($jcharspacing, $jws, $jkashida) = $this->GetJspacing($nb_carac, $nb_spaces, ($maxWidth - $lastitalic - $contentWidth - $WidthCorrection - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) )), $inclCursive, $cOTLdata);
6826 } elseif ($this->checkCJK && $align ==
'J' && $CJKoverflow && $this->allowCJKoverflow && $this->CJKforceend) {
6828 $hanger = mb_substr($content[(count($chunkorder) - 1)], mb_strlen($content[(count($chunkorder) - 1)], $this->mb_enc) - 1, 1, $this->mb_enc);
6829 if (preg_match(
"/[" . $this->CJKoverflow .
"]/u", $hanger)) {
6830 $content[(count($chunkorder) - 1)] = mb_substr($content[(count($chunkorder) - 1)], 0, mb_strlen($content[(count($chunkorder) - 1)], $this->mb_enc) - 1, $this->mb_enc);
6831 $this->restoreFont($font[$chunkorder[count($chunkorder) - 1]],
false);
6832 $contentWidth -= $this->GetStringWidth($hanger) * Mpdf::SCALE;
6834 list($jcharspacing, $jws, $jkashida) = $this->GetJspacing($nb_carac, $nb_spaces, ($maxWidth - $lastitalic - $contentWidth - $WidthCorrection - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) )), $inclCursive, $cOTLdata);
6840 elseif ($contentWidth < ($maxWidth - $lastitalic - $WidthCorrection - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE))) && !$this->fixedlSpacing) {
6841 if ($this->ws > $this->jSmaxWordLast) {
6842 $jws = $this->jSmaxWordLast;
6844 if ($this->charspacing > $this->jSmaxCharLast) {
6845 $jcharspacing = $this->jSmaxCharLast;
6847 $check = $maxWidth - $lastitalic - $WidthCorrection - $contentWidth - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) ) - ( $jcharspacing * $nb_carac) - ( $jws * $nb_spaces);
6854 $empty = $maxWidth - $lastitalic - $WidthCorrection - $contentWidth - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) );
6857 $empty -= ($jcharspacing * ($nb_carac - 1));
6858 $empty -= ($jws * $nb_spaces);
6859 $empty -= ($jkashida);
6861 $empty /= Mpdf::SCALE;
6864 $this->maxPosR = max($this->maxPosR, ($this->w - $this->rMargin - $this->blk[$this->blklvl][
'outer_right_margin'] - $empty));
6865 $this->maxPosL = min($this->maxPosL, ($this->lMargin + $this->blk[$this->blklvl][
'outer_left_margin'] + $empty));
6868 $arraysize = count($chunkorder);
6870 $margins = ($this->cMarginL + $this->cMarginR) + ($ipaddingL + $ipaddingR + $fpaddingR + $fpaddingR );
6873 $this->DivLn($stackHeight, $this->blklvl,
false);
6876 $this->x = $currentx + $this->cMarginL + $ipaddingL + $fpaddingL;
6877 if ($dottab !==
false && $blockdir ==
'rtl') {
6878 $this->x -= $dottab;
6879 } elseif ($align ==
'R') {
6881 } elseif ($align ==
'J' && $blockdir ==
'rtl') {
6883 } elseif ($align ==
'C') {
6884 $this->x += ($empty / 2);
6888 $WidthCorrection = 0;
6889 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && isset($this->blk[$this->blklvl][
'text_indent']) && ($lineCount == 0) && (!$is_table) && ($align !=
'C')) {
6890 $ti = $this->sizeConverter->convert($this->blk[$this->blklvl][
'text_indent'], $this->blk[$this->blklvl][
'inner_width'], $this->blk[$this->blklvl][
'InlineProperties'][
'size'],
false);
6891 if ($blockdir !=
'rtl') {
6896 foreach ($chunkorder as $aord => $k) {
6897 $chunk = $content[$aord];
6898 if (isset($this->objectbuffer[$k]) && $this->objectbuffer[$k]) {
6899 $xadj = $this->x - $this->objectbuffer[$k][
'OUTER-X'];
6900 $this->objectbuffer[$k][
'OUTER-X'] += $xadj;
6901 $this->objectbuffer[$k][
'BORDER-X'] += $xadj;
6902 $this->objectbuffer[$k][
'INNER-X'] += $xadj;
6904 if ($this->objectbuffer[$k][
'type'] ==
'listmarker') {
6905 $this->objectbuffer[$k][
'lineBox'] = $lineBox[-1];
6907 $yadj = $this->y - $this->objectbuffer[$k][
'OUTER-Y'];
6908 if ($this->objectbuffer[$k][
'type'] ==
'dottab') {
6909 $this->objectbuffer[$k][
'lineBox'] = $lineBox[$k];
6911 if ($this->objectbuffer[$k][
'type'] !=
'dottab') {
6912 $yadj += $lineBox[$k][
'top'];
6914 $this->objectbuffer[$k][
'OUTER-Y'] += $yadj;
6915 $this->objectbuffer[$k][
'BORDER-Y'] += $yadj;
6916 $this->objectbuffer[$k][
'INNER-Y'] += $yadj;
6919 $this->restoreFont($font[$k]);
6921 if ($is_table && substr($align, 0, 1) ==
'D' && $aord == 0) {
6922 $dp = $this->decimal_align[substr($align, 0, 2)];
6923 $s = preg_split(
'/' . preg_quote($dp,
'/') .
'/', $content[0], 2);
6924 $s0 = $this->GetStringWidth($s[0],
false);
6925 $this->x += ($this->decimal_offset - $s0);
6928 $this->SetSpacing(($this->fixedlSpacing * Mpdf::SCALE) + $jcharspacing, ($this->fixedlSpacing + $this->minwSpacing) * Mpdf::SCALE + $jws);
6929 $this->fixedlSpacing =
false;
6930 $this->minwSpacing = 0;
6932 $save_vis = $this->visibility;
6933 if (isset($this->textparam[
'visibility']) && $this->textparam[
'visibility'] && $this->textparam[
'visibility'] != $this->visibility) {
6934 $this->SetVisibility($this->textparam[
'visibility']);
6938 if (isset($this->spanbgcolor) && $this->spanbgcolor) {
6939 $cor = $this->spanbgcolorarray;
6940 $this->SetFColor($cor);
6945 if (!empty($this->spanborddet)) {
6946 if (strpos($contentB[$k],
'L') !==
false && isset($this->spanborddet[
'L'])) {
6947 $this->x += $this->spanborddet[
'L'][
'w'];
6949 if (strpos($contentB[$k],
'L') ===
false) {
6950 $this->spanborddet[
'L'][
's'] = $this->spanborddet[
'L'][
'w'] = 0;
6952 if (strpos($contentB[$k],
'R') ===
false) {
6953 $this->spanborddet[
'R'][
's'] = $this->spanborddet[
'R'][
'w'] = 0;
6958 $stringWidth = $this->GetStringWidth($chunk,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar);
6959 $nch = mb_strlen($chunk, $this->mb_enc);
6961 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
6962 if (isset($cOTLdata[$aord][
'group']) && $cOTLdata[$aord][
'group']) {
6963 $nch -= substr_count($cOTLdata[$aord][
'group'],
'M');
6966 $stringWidth += ( $this->charspacing * $nch / Mpdf::SCALE );
6968 $stringWidth += ( $this->ws * mb_substr_count($chunk,
' ', $this->mb_enc) / Mpdf::SCALE );
6970 if (isset($this->objectbuffer[$k])) {
6971 if ($this->objectbuffer[$k][
'type'] ==
'dottab') {
6972 $this->objectbuffer[$k][
'OUTER-WIDTH'] +=$empty;
6973 $this->objectbuffer[$k][
'OUTER-WIDTH'] +=$this->objectbuffer[$k][
'outdent'];
6976 if ($this->objectbuffer[$k][
'type'] ==
'image' && isset($this->objectbuffer[$k][
'listmarker']) && $this->objectbuffer[$k][
'listmarker'] && $this->objectbuffer[$k][
'listmarkerposition'] ==
'outside') {
6979 $stringWidth = $this->objectbuffer[$k][
'OUTER-WIDTH'];
6983 if ($stringWidth == 0) {
6984 $stringWidth = 0.000001;
6986 if ($aord == $arraysize - 1) {
6988 if ($this->checkCJK && $CJKoverflow && $align ==
'J' && $this->allowCJKoverflow && $hanger && $this->CJKforceend) {
6990 $this->Cell($stringWidth, $stackHeight, $chunk,
'', 0,
'', $fill, $this->HREF, $currentx, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
6991 $this->Cell($this->GetStringWidth($hanger), $stackHeight, $hanger,
'', 1,
'', $fill, $this->HREF, $currentx, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
6993 $this->Cell($stringWidth, $stackHeight, $chunk,
'', 1,
'', $fill, $this->HREF, $currentx, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
6996 $this->Cell($stringWidth, $stackHeight, $chunk,
'', 0,
'', $fill, $this->HREF, 0, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
7000 if (!empty($this->spanborddet)) {
7001 if (strpos($contentB[$k],
'R') !==
false && $aord != $arraysize - 1) {
7002 $this->x += $this->spanborddet[
'R'][
'w'];
7006 if (isset($spanfill) && $spanfill) {
7010 $this->SetFColor($bcor);
7013 if (isset($this->textparam[
'visibility']) && $this->textparam[
'visibility'] && $this->visibility != $save_vis) {
7014 $this->SetVisibility($save_vis);
7018 $this->printobjectbuffer($is_table, $blockdir);
7019 $this->objectbuffer = [];
7020 $this->ResetSpacing();
7025 if ($this->floatmargins) {
7026 $this->_advanceFloatMargins();
7030 if ($endofblock && $blockstate > 1) {
7032 if (isset($this->floatmargins[
'R'][
'y1'])) {
7033 $fry1 = $this->floatmargins[
'R'][
'y1'];
7037 if (isset($this->floatmargins[
'L'][
'y1'])) {
7038 $fly1 = $this->floatmargins[
'L'][
'y1'];
7042 if ($this->y < $fry1 || $this->y < $fly1) {
7043 $drop = max($fry1, $fly1) - $this->y;
7044 $this->DivLn($drop);
7045 $this->x = $currentx;
7052 if ($endofblock && ($blockstate > 1) && ($this->blk[$this->blklvl][
'padding_bottom'] || $this->blk[$this->blklvl][
'border_bottom'] || $this->blk[$this->blklvl][
'css_set_height']) && (!$is_table)) {
7056 if (isset($this->blk[$this->blklvl][
'css_set_height']) && $this->blk[$this->blklvl][
'css_set_height'] && $this->blk[$this->blklvl][
'startpage'] == $this->page) {
7058 $h1 = ($this->y - $this->blk[$this->blklvl][
'y0']) + $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w'];
7059 if ($h1 < ($this->blk[$this->blklvl][
'css_set_height'] + $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'padding_top'])) {
7060 $extra = ($this->blk[$this->blklvl][
'css_set_height'] + $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'padding_top']) - $h1;
7062 if ($this->y + $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w'] + $extra > $this->PageBreakTrigger) {
7063 $extra = $this->PageBreakTrigger - ($this->y + $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w']);
7068 $this->DivLn($this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w'] + $extra, -3,
true,
false, 2);
7069 $this->x = $currentx;
7071 if ($this->ColActive) {
7072 $this->breakpoints[$this->CurrCol][] = $this->y;
7077 if (($endofblock) && ($blockstate > 1) && (!$is_table)) {
7078 $this->blk[$this->blklvl][
'y1'] = $this->y;
7082 if (($endofblock) && ($blockstate > 1) && ($this->blk[$this->blklvl][
'margin_bottom']) && (!$is_table)) {
7083 if ($this->y + $this->blk[$this->blklvl][
'margin_bottom'] < $this->PageBreakTrigger and ! $this->InFooter) {
7084 $this->DivLn($this->blk[$this->blklvl][
'margin_bottom'], $this->blklvl - 1,
true, $this->blk[$this->blklvl][
'margin_collapse']);
7085 if ($this->ColActive) {
7086 $this->breakpoints[$this->CurrCol][] = $this->y;
7092 $stackHeight = $this->divheight;
7098 $blockdir = $this->directionality;
7101 if ($is_table && $this->shrin_k > 1) {
7102 $k = $this->shrin_k;
7110 $save_currentfontfamily = $this->FontFamily;
7111 $save_currentfontsize = $this->FontSizePt;
7112 $save_currentfontstyle = $this->FontStyle;
7114 if ($blockdir ==
'rtl') {
7120 foreach ($this->objectbuffer as $ib => $objattr) {
7122 if ($objattr[
'type'] ==
'bookmark' || $objattr[
'type'] ==
'indexentry' || $objattr[
'type'] ==
'toc') {
7123 $x = $objattr[
'OUTER-X'];
7124 $y = $objattr[
'OUTER-Y'];
7125 $this->y = $y - $this->FontSize / 2;
7127 if ($objattr[
'type'] ==
'bookmark') {
7128 $this->Bookmark($objattr[
'CONTENT'], $objattr[
'bklevel'], $y - $this->FontSize);
7130 if ($objattr[
'type'] ==
'indexentry') {
7131 $this->IndexEntry($objattr[
'CONTENT']);
7133 if ($objattr[
'type'] ==
'toc') {
7134 $this->TOC_Entry($objattr[
'CONTENT'], $objattr[
'toclevel'], (isset($objattr[
'toc_id']) ? $objattr[
'toc_id'] :
''));
7136 } elseif ($objattr[
'type'] ==
'annot') {
7137 if ($objattr[
'POS-X']) {
7138 $x = $objattr[
'POS-X'];
7139 } elseif ($this->annotMargin <> 0) {
7140 $x = -$objattr[
'OUTER-X'];
7142 $x = $objattr[
'OUTER-X'];
7144 if ($objattr[
'POS-Y']) {
7145 $y = $objattr[
'POS-Y'];
7147 $y = $objattr[
'OUTER-Y'] - $this->FontSize / 2;
7154 $this->Line($x - 1, $y - 1, $x - 1, $y - 1);
7155 $this->Annotation($objattr[
'CONTENT'], $x, $y, $objattr[
'ICON'], $objattr[
'AUTHOR'], $objattr[
'SUBJECT'], $objattr[
'OPACITY'], $objattr[
'COLOR'], (isset($objattr[
'POPUP']) ? $objattr[
'POPUP'] :
''), (isset($objattr[
'FILE']) ? $objattr[
'FILE'] :
''));
7157 $y = $objattr[
'OUTER-Y'];
7158 $x = $objattr[
'OUTER-X'];
7159 $w = $objattr[
'OUTER-WIDTH'];
7160 $h = $objattr[
'OUTER-HEIGHT'];
7161 if (isset($objattr[
'text'])) {
7162 $texto = $objattr[
'text'];
7166 if (isset($objattr[
'fontfamily'])) {
7167 $this->
SetFont($objattr[
'fontfamily'],
'', $objattr[
'fontsize']);
7172 if ($objattr[
'type'] ==
'hr') {
7173 $this->SetDColor($objattr[
'color']);
7174 switch ($objattr[
'align']) {
7176 $empty = $objattr[
'OUTER-WIDTH'] - $objattr[
'INNER-WIDTH'];
7181 $empty = $objattr[
'OUTER-WIDTH'] - $objattr[
'INNER-WIDTH'];
7185 $oldlinewidth = $this->LineWidth;
7187 $this->y += ($objattr[
'linewidth'] / 2) + $objattr[
'margin_top'] / $k;
7188 $this->Line($x, $this->y, $x + $objattr[
'INNER-WIDTH'], $this->y);
7190 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
7193 if ($objattr[
'type'] ==
'image') {
7195 if (isset($objattr[
'transform'])) {
7196 $this->writer->write(
"\n" .
'% BTR');
7198 if (isset($objattr[
'z-index']) && $objattr[
'z-index'] > 0 && $this->current_layer == 0) {
7199 $this->BeginLayer($objattr[
'z-index']);
7201 if (isset($objattr[
'visibility']) && $objattr[
'visibility'] !=
'visible' && $objattr[
'visibility']) {
7202 $this->SetVisibility($objattr[
'visibility']);
7204 if (isset($objattr[
'opacity'])) {
7205 $this->SetAlpha($objattr[
'opacity']);
7208 $obiw = $objattr[
'INNER-WIDTH'];
7209 $obih = $objattr[
'INNER-HEIGHT'];
7211 $sx = $objattr[
'orig_w'] ? ($objattr[
'INNER-WIDTH'] * Mpdf::SCALE / $objattr[
'orig_w']) : INF;
7212 $sy = $objattr[
'orig_h'] ? ($objattr[
'INNER-HEIGHT'] * Mpdf::SCALE / $objattr[
'orig_h']) : INF;
7215 if (isset($objattr[
'ROTATE'])) {
7216 $rotate = $objattr[
'ROTATE'];
7219 if ($rotate == 90) {
7221 $obiw = $objattr[
'INNER-HEIGHT'];
7222 $obih = $objattr[
'INNER-WIDTH'];
7223 $tr = $this->transformTranslate(0, -$objattr[
'INNER-WIDTH'],
true);
7224 $tr .=
' ' . $this->transformRotate(90, $objattr[
'INNER-X'], ($objattr[
'INNER-Y'] + $objattr[
'INNER-WIDTH']),
true);
7225 $sx = $obiw * Mpdf::SCALE / $objattr[
'orig_h'];
7226 $sy = $obih * Mpdf::SCALE / $objattr[
'orig_w'];
7227 } elseif ($rotate == -90 || $rotate == 270) {
7229 $obiw = $objattr[
'INNER-HEIGHT'];
7230 $obih = $objattr[
'INNER-WIDTH'];
7231 $tr = $this->transformTranslate($objattr[
'INNER-WIDTH'], ($objattr[
'INNER-HEIGHT'] - $objattr[
'INNER-WIDTH']),
true);
7232 $tr .=
' ' . $this->transformRotate(-90, $objattr[
'INNER-X'], ($objattr[
'INNER-Y'] + $objattr[
'INNER-WIDTH']),
true);
7233 $sx = $obiw * Mpdf::SCALE / $objattr[
'orig_h'];
7234 $sy = $obih * Mpdf::SCALE / $objattr[
'orig_w'];
7235 } elseif ($rotate == 180) {
7237 $tr = $this->transformTranslate($objattr[
'INNER-WIDTH'], -$objattr[
'INNER-HEIGHT'],
true);
7238 $tr .=
' ' . $this->transformRotate(180, $objattr[
'INNER-X'], ($objattr[
'INNER-Y'] + $objattr[
'INNER-HEIGHT']),
true);
7250 if (isset($objattr[
'transform'])) {
7255 preg_match_all(
'/(translatex|translatey|translate|scalex|scaley|scale|rotate|skewX|skewY|skew)\((.*?)\)/is', $objattr[
'transform'], $m);
7257 for ($i = 0; $i < count($m[0]); $i++) {
7258 $c = strtolower($m[1][$i]);
7259 $v = trim($m[2][$i]);
7260 $vv = preg_split(
'/[ ,]+/', $v);
7261 if ($c ==
'translate' && count($vv)) {
7262 $translate_x = $this->sizeConverter->convert($vv[0], $maxsize_x,
false,
false);
7263 if (count($vv) == 2) {
7264 $translate_y = $this->sizeConverter->convert($vv[1], $maxsize_y,
false,
false);
7268 $tr2 .= $this->transformTranslate($translate_x, $translate_y,
true) .
' ';
7269 } elseif ($c ==
'translatex' && count($vv)) {
7270 $translate_x = $this->sizeConverter->convert($vv[0], $maxsize_x,
false,
false);
7271 $tr2 .= $this->transformTranslate($translate_x, 0,
true) .
' ';
7272 } elseif ($c ==
'translatey' && count($vv)) {
7273 $translate_y = $this->sizeConverter->convert($vv[1], $maxsize_y,
false,
false);
7274 $tr2 .= $this->transformTranslate(0, $translate_y,
true) .
' ';
7275 } elseif ($c ==
'scale' && count($vv)) {
7276 $scale_x = $vv[0] * 100;
7277 if (count($vv) == 2) {
7278 $scale_y = $vv[1] * 100;
7280 $scale_y = $scale_x;
7282 $tr2 .= $this->transformScale($scale_x, $scale_y, $cx, $cy,
true) .
' ';
7283 } elseif ($c ==
'scalex' && count($vv)) {
7284 $scale_x = $vv[0] * 100;
7285 $tr2 .= $this->transformScale($scale_x, 0, $cx, $cy,
true) .
' ';
7286 } elseif ($c ==
'scaley' && count($vv)) {
7287 $scale_y = $vv[1] * 100;
7288 $tr2 .= $this->transformScale(0, $scale_y, $cx, $cy,
true) .
' ';
7289 } elseif ($c ==
'skew' && count($vv)) {
7290 $angle_x = $this->ConvertAngle($vv[0],
false);
7291 if (count($vv) == 2) {
7292 $angle_y = $this->ConvertAngle($vv[1],
false);
7296 $tr2 .= $this->transformSkew($angle_x, $angle_y, $cx, $cy,
true) .
' ';
7297 } elseif ($c ==
'skewx' && count($vv)) {
7298 $angle = $this->ConvertAngle($vv[0],
false);
7299 $tr2 .= $this->transformSkew($angle, 0, $cx, $cy,
true) .
' ';
7300 } elseif ($c ==
'skewy' && count($vv)) {
7301 $angle = $this->ConvertAngle($vv[0],
false);
7302 $tr2 .= $this->transformSkew(0, $angle, $cx, $cy,
true) .
' ';
7303 } elseif ($c ==
'rotate' && count($vv)) {
7304 $angle = $this->ConvertAngle($vv[0]);
7305 $tr2 .= $this->transformRotate($angle, $cx, $cy,
true) .
' ';
7312 if (isset($objattr[
'listmarker']) && $objattr[
'listmarker'] && $objattr[
'listmarkerposition'] ==
'outside') {
7313 $mw = $objattr[
'OUTER-WIDTH'];
7315 $adjx = $this->sizeConverter->convert($this->list_marker_offset, $this->FontSize);
7316 if ($objattr[
'dir'] ==
'rtl') {
7317 $objattr[
'INNER-X'] += $adjx;
7319 $objattr[
'INNER-X'] -= $adjx;
7320 $objattr[
'INNER-X'] -= $mw;
7326 $this->writer->write(
'q ' . $tr2 .
' ');
7328 if (isset($objattr[
'bgcolor']) && $objattr[
'bgcolor']) {
7329 $bgcol = $objattr[
'bgcolor'];
7330 $this->SetFColor($bgcol);
7331 $this->Rect($x, $y, $w, $h,
'F');
7332 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
7335 $this->writer->write(
'Q');
7339 if (isset($objattr[
'GRADIENT-MASK'])) {
7340 $g = $this->gradient->parseMozGradient($objattr[
'GRADIENT-MASK']);
7342 $dummy = $this->gradient->Gradient($objattr[
'INNER-X'], $objattr[
'INNER-Y'], $obiw, $obih, $g[
'type'], $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend'],
true,
true);
7343 $gradmask =
'/TGS' . count($this->gradients) .
' gs ';
7348 if (isset($objattr[
'itype']) && $objattr[
'itype'] ==
'wmf') {
7349 $outstring = sprintf(
'q ' . $tr . $tr2 .
'%.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, -$sy, $objattr[
'INNER-X'] * Mpdf::SCALE - $sx * $objattr[
'wmf_x'], (($this->h - $objattr[
'INNER-Y']) * Mpdf::SCALE) + $sy * $objattr[
'wmf_y'], $objattr[
'ID']);
7351 if (isset($objattr[
'itype']) && $objattr[
'itype'] ==
'svg') {
7352 $outstring = sprintf(
'q ' . $tr . $tr2 .
'%.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, -$sy, $objattr[
'INNER-X'] * Mpdf::SCALE - $sx * $objattr[
'wmf_x'], (($this->h - $objattr[
'INNER-Y']) * Mpdf::SCALE) + $sy * $objattr[
'wmf_y'], $objattr[
'ID']);
7354 $outstring = sprintf(
"q " . $tr . $tr2 .
"%.3F 0 0 %.3F %.3F %.3F cm " . $gradmask .
"/I%d Do Q", $obiw * Mpdf::SCALE, $obih * Mpdf::SCALE, $objattr[
'INNER-X'] * Mpdf::SCALE, ($this->h - ($objattr[
'INNER-Y'] + $obih )) * Mpdf::SCALE, $objattr[
'ID']);
7357 $this->writer->write($outstring);
7359 if (isset($objattr[
'link'])) {
7360 $this->
Link($objattr[
'INNER-X'], $objattr[
'INNER-Y'], $objattr[
'INNER-WIDTH'], $objattr[
'INNER-HEIGHT'], $objattr[
'link']);
7362 if (isset($objattr[
'opacity'])) {
7369 $this->writer->write(
'q ' . $tr2 .
' ');
7371 if ((isset($objattr[
'border_top']) && $objattr[
'border_top'] > 0) || (isset($objattr[
'border_left']) && $objattr[
'border_left'] > 0) || (isset($objattr[
'border_right']) && $objattr[
'border_right'] > 0) || (isset($objattr[
'border_bottom']) && $objattr[
'border_bottom'] > 0)) {
7372 $this->PaintImgBorder($objattr, $is_table);
7375 $this->writer->write(
'Q');
7378 if (isset($objattr[
'visibility']) && $objattr[
'visibility'] !=
'visible' && $objattr[
'visibility']) {
7379 $this->SetVisibility(
'visible');
7381 if (isset($objattr[
'z-index']) && $objattr[
'z-index'] > 0 && $this->current_layer == 0) {
7385 if (isset($objattr[
'transform'])) {
7386 $this->writer->write(
"\n" .
'% ETR');
7390 if ($objattr[
'type'] ===
'barcode') {
7392 $bgcol = $this->colorConverter->convert(255, $this->PDFAXwarnings);
7394 if (isset($objattr[
'bgcolor']) && $objattr[
'bgcolor']) {
7395 $bgcol = $objattr[
'bgcolor'];
7398 $col = $this->colorConverter->convert(0, $this->PDFAXwarnings);
7400 if (isset($objattr[
'color']) && $objattr[
'color']) {
7401 $col = $objattr[
'color'];
7404 $this->SetFColor($bgcol);
7405 $this->Rect($objattr[
'BORDER-X'], $objattr[
'BORDER-Y'], $objattr[
'BORDER-WIDTH'], $objattr[
'BORDER-HEIGHT'],
'F');
7406 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
7408 if (isset($objattr[
'BORDER-WIDTH'])) {
7409 $this->PaintImgBorder($objattr, $is_table);
7412 $barcodeTypes = [
'EAN13',
'ISBN',
'ISSN',
'UPCA',
'UPCE',
'EAN8'];
7413 if (in_array($objattr[
'btype'], $barcodeTypes,
true)) {
7415 $this->WriteBarcode(
7417 $objattr[
'showtext'],
7418 $objattr[
'INNER-X'],
7419 $objattr[
'INNER-Y'],
7426 $objattr[
'bheight'],
7431 (isset($objattr[
'bsupp_code']) ? $objattr[
'bsupp_code'] :
''),
7435 } elseif ($objattr[
'btype'] ===
'QR') {
7437 if (!class_exists(
'Mpdf\QrCode\QrCode') || !class_exists(
'Mpdf\QrCode\Output\Mpdf')) {
7438 throw new \Mpdf\MpdfException(
'Mpdf\QrCode package was not found. Install the package from Packagist with "composer require mpdf/qrcode"');
7441 $barcodeContent = str_replace(
'\r\n',
"\r\n", $objattr[
'code']);
7442 $barcodeContent = str_replace(
'\n',
"\n", $barcodeContent);
7444 $qrcode =
new QrCode\QrCode($barcodeContent, $objattr[
'errorlevel']);
7445 if ($objattr[
'disableborder']) {
7446 $qrcode->disableBorder();
7449 $bgColor = [255, 255, 255];
7450 if ($objattr[
'bgcolor']) {
7451 $bgColor = array_map(
7453 return intval(255 * floatval($col));
7455 explode(
" ", $this->SetColor($objattr[
'bgcolor'],
'CodeOnly'))
7459 if ($objattr[
'color']) {
7462 return intval(255 * floatval($col));
7464 explode(
" ", $this->SetColor($objattr[
'color'],
'CodeOnly'))
7468 $out =
new QrCode\Output\Mpdf();
7472 $objattr[
'INNER-X'],
7473 $objattr[
'INNER-Y'],
7474 $objattr[
'bsize'] * 25,
7482 $this->WriteBarcode2(
7484 $objattr[
'INNER-X'],
7485 $objattr[
'INNER-Y'],
7487 $objattr[
'bheight'],
7491 $objattr[
'pr_ratio'],
7493 $objattr[
'quiet_zone_left'],
7494 $objattr[
'quiet_zone_right']
7500 if ($objattr[
'type'] ==
'textcircle') {
7502 if (isset($objattr[
'bgcolor']) && $objattr[
'bgcolor']) {
7503 $bgcol = $objattr[
'bgcolor'];
7505 $col = $this->colorConverter->convert(0, $this->PDFAXwarnings);
7506 if (isset($objattr[
'color']) && $objattr[
'color']) {
7507 $col = $objattr[
'color'];
7509 $this->SetTColor($col);
7510 $this->SetFColor($bgcol);
7512 $this->Rect($objattr[
'BORDER-X'], $objattr[
'BORDER-Y'], $objattr[
'BORDER-WIDTH'], $objattr[
'BORDER-HEIGHT'],
'F');
7514 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
7515 if (isset($objattr[
'BORDER-WIDTH'])) {
7516 $this->PaintImgBorder($objattr, $is_table);
7518 if (empty($this->directWrite)) {
7519 $this->directWrite =
new DirectWrite($this, $this->otl, $this->sizeConverter, $this->colorConverter);
7521 if (isset($objattr[
'top-text'])) {
7522 $this->directWrite->CircularText($objattr[
'INNER-X'] + $objattr[
'INNER-WIDTH'] / 2, $objattr[
'INNER-Y'] + $objattr[
'INNER-HEIGHT'] / 2, $objattr[
'r'] / $k, $objattr[
'top-text'],
'top', $objattr[
'fontfamily'], $objattr[
'fontsize'] / $k, $objattr[
'fontstyle'], $objattr[
'space-width'], $objattr[
'char-width'], (isset($objattr[
'divider']) ? $objattr[
'divider'] :
''));
7524 if (isset($objattr[
'bottom-text'])) {
7525 $this->directWrite->CircularText($objattr[
'INNER-X'] + $objattr[
'INNER-WIDTH'] / 2, $objattr[
'INNER-Y'] + $objattr[
'INNER-HEIGHT'] / 2, $objattr[
'r'] / $k, $objattr[
'bottom-text'],
'bottom', $objattr[
'fontfamily'], $objattr[
'fontsize'] / $k, $objattr[
'fontstyle'], $objattr[
'space-width'], $objattr[
'char-width'], (isset($objattr[
'divider']) ? $objattr[
'divider'] :
''));
7529 $this->ResetSpacing();
7532 if ($objattr[
'type'] ==
'listmarker') {
7533 if (isset($objattr[
'fontfamily'])) {
7534 $this->
SetFont($objattr[
'fontfamily'], $objattr[
'fontstyle'], $objattr[
'fontsizept']);
7536 $col = $this->colorConverter->convert(0, $this->PDFAXwarnings);
7537 if (isset($objattr[
'colorarray']) && ($objattr[
'colorarray'])) {
7538 $col = $objattr[
'colorarray'];
7541 if (isset($objattr[
'bullet']) && $objattr[
'bullet']) {
7542 $type = $objattr[
'bullet'];
7543 $size = $objattr[
'size'];
7545 if ($objattr[
'listmarkerposition'] ==
'inside') {
7547 if ($objattr[
'dir'] ==
'rtl') {
7548 $adjx += $objattr[
'offset'];
7552 $adjx = $objattr[
'offset'];
7554 if ($objattr[
'dir'] ==
'rtl') {
7561 $yadj = $objattr[
'lineBox'][
'glyphYorigin'];
7562 if (isset($this->CurrentFont[
'desc'][
'XHeight']) && $this->CurrentFont[
'desc'][
'XHeight']) {
7563 $xh = $this->CurrentFont[
'desc'][
'XHeight'];
7567 $yadj -= ($this->FontSize * $xh / 1000) * 0.625;
7570 $this->_printListBullet($this->x, $this->y, $size, $type, $col);
7572 $this->SetTColor($col);
7573 $w = $this->GetStringWidth($texto);
7575 $adjx = $this->sizeConverter->convert($this->list_marker_offset, $this->FontSize);
7576 if ($objattr[
'dir'] ==
'rtl') {
7585 $this->Cell($w, $this->FontSize, $texto, 0, 0, $align, 0,
'', 0, 0, 0,
'T', 0,
false,
false, 0, $objattr[
'lineBox']);
7586 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
7591 if ($objattr[
'type'] ==
'dottab') {
7592 if (isset($objattr[
'fontfamily'])) {
7593 $this->
SetFont($objattr[
'fontfamily'],
'', $objattr[
'fontsize']);
7595 $sp = $this->GetStringWidth(
' ');
7596 $nb = floor(($w - 2 * $sp) / $this->GetStringWidth(
'.'));
7598 $dots =
' ' . str_repeat(
'.', $nb) .
' ';
7602 $col = $this->colorConverter->convert(0, $this->PDFAXwarnings);
7603 if (isset($objattr[
'colorarray']) && ($objattr[
'colorarray'])) {
7604 $col = $objattr[
'colorarray'];
7606 $this->SetTColor($col);
7607 $save_dh = $this->divheight;
7608 $save_sbd = $this->spanborddet;
7609 $save_textvar = $this->textvar;
7610 $this->spanborddet =
'';
7611 $this->divheight = 0;
7612 $this->textvar = 0x00;
7614 $this->Cell($w, $h, $dots, 0, 0,
'C', 0,
'', 0, 0, 0,
'T', 0,
false,
false, 0, $objattr[
'lineBox']);
7615 $this->spanborddet = $save_sbd;
7616 $this->textvar = $save_textvar;
7617 $this->divheight = $save_dh;
7618 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
7623 if ($objattr[
'type'] ==
'input' && ($objattr[
'subtype'] ==
'TEXT' || $objattr[
'subtype'] ==
'PASSWORD')) {
7624 $this->form->print_ob_text($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir);
7628 if ($objattr[
'type'] ==
'textarea') {
7629 $this->form->print_ob_textarea($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir);
7633 if ($objattr[
'type'] ==
'select') {
7634 $this->form->print_ob_select($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir);
7639 if ($objattr[
'type'] ==
'input' && $objattr[
'subtype'] ==
'IMAGE') {
7640 $this->form->print_ob_imageinput($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir, $is_table);
7644 if ($objattr[
'type'] ==
'input' && ($objattr[
'subtype'] ==
'SUBMIT' || $objattr[
'subtype'] ==
'RESET' || $objattr[
'subtype'] ==
'BUTTON')) {
7645 $this->form->print_ob_button($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir);
7649 if ($objattr[
'type'] ==
'input' && ($objattr[
'subtype'] ==
'CHECKBOX')) {
7650 $this->form->print_ob_checkbox($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir, $x, $y);
7653 if ($objattr[
'type'] ==
'input' && ($objattr[
'subtype'] ==
'RADIO')) {
7654 $this->form->print_ob_radio($objattr, $w, $h, $texto, $rtlalign, $k, $blockdir, $x, $y);
7659 $this->
SetFont($save_currentfontfamily, $save_currentfontstyle, $save_currentfontsize);
7670 $fcol = $this->SetTColor($color,
true);
7671 $lcol = strtoupper($fcol);
7672 $this->writer->write(sprintf(
'q %s %s', $lcol, $fcol));
7673 $this->writer->write(
'0 j 0 J [] 0 d');
7674 if ($type ==
'square') {
7676 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F re f', ($x - $size / 2) * Mpdf::SCALE, ($this->h - $y + $size / 2) * Mpdf::SCALE, ($size) * Mpdf::SCALE, (-$size) * Mpdf::SCALE));
7677 } elseif ($type ==
'disc') {
7678 $this->Circle($x, $y, $size / 2,
'F');
7679 } elseif ($type ==
'circle') {
7681 $this->writer->write(sprintf(
'%.3F w ', $lw * Mpdf::SCALE));
7682 $this->Circle($x, $y, $size / 2 - $lw / 2,
'S');
7684 $this->writer->write(
'Q');
7693 while ($charctr < 0) {
7695 if ($contentctr < 0) {
7698 if ($this->usingCoreFont) {
7699 $charctr = strlen($content[$contentctr]) - 1;
7701 $charctr = mb_strlen($content[$contentctr], $this->mb_enc) - 1;
7704 if ($this->usingCoreFont) {
7705 $lastchar = $content[$contentctr][$charctr];
7707 $lastchar = mb_substr($content[$contentctr], $charctr, 1, $this->mb_enc);
7717 while ($charctr < 0) {
7719 if ($contentctr < 0) {
7722 if ($this->usingCoreFont) {
7723 $charctr = strlen($content[$contentctr]) - 1;
7725 $charctr = mb_strlen($content[$contentctr], $this->mb_enc) - 1;
7728 if ($this->usingCoreFont) {
7729 $lastchar = $content[$contentctr][$charctr];
7731 $lastchar = mb_substr($content[$contentctr], $charctr, 1, $this->mb_enc);
7739 $currentx = $this->x;
7740 $is_table = $this->flowingBlockAttr[
'is_table'];
7741 $table_draft = $this->flowingBlockAttr[
'table_draft'];
7743 $contentWidth = & $this->flowingBlockAttr[
'contentWidth'];
7745 $maxWidth = & $this->flowingBlockAttr[
'width'];
7746 $lineCount = & $this->flowingBlockAttr[
'lineCount'];
7748 $stackHeight = & $this->flowingBlockAttr[
'height'];
7749 $align = & $this->flowingBlockAttr[
'align'];
7750 $content = & $this->flowingBlockAttr[
'content'];
7751 $contentB = & $this->flowingBlockAttr[
'contentB'];
7752 $font = & $this->flowingBlockAttr[
'font'];
7753 $valign = & $this->flowingBlockAttr[
'valign'];
7754 $blockstate = $this->flowingBlockAttr[
'blockstate'];
7755 $cOTLdata = & $this->flowingBlockAttr[
'cOTLdata'];
7757 $newblock = $this->flowingBlockAttr[
'newblock'];
7758 $blockdir = $this->flowingBlockAttr[
'blockdir'];
7761 if ($this->blk[$this->blklvl][
'bgcolor'] && !$is_table) {
7764 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
7767 $font[] = $this->saveFont();
7770 $cOTLdata[] = $sOTLdata;
7771 $currContent = & $content[count($content) - 1];
7773 $CJKoverflow =
false;
7778 $oldcolumn = $this->CurrCol;
7779 if ($this->ColActive && !$is_table) {
7780 $this->breakpoints[$this->CurrCol][] = $this->y;
7789 $cpaddingadjustL = 0;
7790 $cpaddingadjustR = 0;
7796 $ipaddingL = $this->blk[$this->blklvl][
'padding_left'];
7797 $ipaddingR = $this->blk[$this->blklvl][
'padding_right'];
7798 $paddingL = ($ipaddingL * Mpdf::SCALE);
7799 $paddingR = ($ipaddingR * Mpdf::SCALE);
7800 $this->cMarginL = $this->blk[$this->blklvl][
'border_left'][
'w'];
7801 $cpaddingadjustL = -$this->cMarginL;
7802 $this->cMarginR = $this->blk[$this->blklvl][
'border_right'][
'w'];
7803 $cpaddingadjustR = -$this->cMarginR;
7808 if (count($this->floatDivs)) {
7809 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($this->blklvl);
7811 $fpaddingR = $r_width;
7814 $fpaddingL = $l_width;
7819 $usey = $this->y + 0.002;
7820 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 0)) {
7821 $usey += $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'];
7825 if (isset($this->floatmargins[
'R']) && $usey <= $this->floatmargins[
'R'][
'y1'] && $usey >= $this->floatmargins[
'R'][
'y0'] && !$this->floatmargins[
'R'][
'skipline']) {
7826 $fpaddingR += $this->floatmargins[
'R'][
'w'];
7828 if (isset($this->floatmargins[
'L']) && $usey <= $this->floatmargins[
'L'][
'y1'] && $usey >= $this->floatmargins[
'L'][
'y0'] && !$this->floatmargins[
'L'][
'skipline']) {
7829 $fpaddingL += $this->floatmargins[
'L'][
'w'];
7834 if (substr($s, 0, 3) ==
"\xbb\xa4\xac") {
7835 $objattr = $this->_getObjAttr($s);
7838 $maximumW = ($maxWidth / Mpdf::SCALE) - ($this->cellPaddingL + $this->cMarginL + $this->cellPaddingR + $this->cMarginR);
7841 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 0) && (!$is_table)) {
7842 $h_corr = $this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'];
7844 $maximumW = ($maxWidth / Mpdf::SCALE) - ($this->blk[$this->blklvl][
'padding_left'] + $this->blk[$this->blklvl][
'border_left'][
'w'] + $this->blk[$this->blklvl][
'padding_right'] + $this->blk[$this->blklvl][
'border_right'][
'w'] + $fpaddingL + $fpaddingR );
7846 $objattr = $this->inlineObject($objattr[
'type'], $this->lMargin + $fpaddingL + ($contentWidth / Mpdf::SCALE), ($this->y + $h_corr), $objattr, $this->lMargin, ($contentWidth / Mpdf::SCALE), $maximumW, $stackHeight,
true, $is_table);
7849 $stackHeight = max($stackHeight, $objattr[
'OUTER-HEIGHT']);
7850 $this->objectbuffer[count($content) - 1] = $objattr;
7854 if ($objattr[
'type'] ==
'image' && isset($objattr[
'listmarker']) && $objattr[
'listmarker'] && $objattr[
'listmarkerposition'] ==
'outside') {
7857 $contentWidth += ($objattr[
'OUTER-WIDTH'] * Mpdf::SCALE);
7863 if (!empty($this->spanborddet)) {
7864 if (isset($this->spanborddet[
'L'])) {
7865 $lbw = $this->spanborddet[
'L'][
'w'];
7867 if (isset($this->spanborddet[
'R'])) {
7868 $rbw = $this->spanborddet[
'R'][
'w'];
7872 if ($this->usingCoreFont) {
7875 $clen = mb_strlen($s, $this->mb_enc);
7879 for ($i = 0; $i < $clen; $i++) {
7882 if ($this->usingCoreFont) {
7885 $cw = ($this->GetCharWidthCore($c) * Mpdf::SCALE);
7887 if (isset($this->CurrentFont[
'kerninfo'][$s[($i - 1)]][$c])) {
7888 $cw += ($this->CurrentFont[
'kerninfo'][$s[($i - 1)]][$c] * $this->FontSizePt / 1000 );
7892 $c = mb_substr($s, $i, 1, $this->mb_enc);
7893 $cw = ($this->GetCharWidthNonCore($c,
false) * Mpdf::SCALE);
7896 if (isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF)) {
7900 if (isset($sOTLdata[
'GPOSinfo'][$i][
'XAdvanceL'])) {
7901 $cw += $sOTLdata[
'GPOSinfo'][$i][
'XAdvanceL'] * (1000 / $this->CurrentFont[
'unitsPerEm']) * ($this->FontSize / 1000) * Mpdf::SCALE;
7905 $lastc = mb_substr($s, ($i - 1), 1, $this->mb_enc);
7906 $ulastc = $this->UTF8StringToArray($lastc,
false);
7907 $uc = $this->UTF8StringToArray($c,
false);
7908 if (isset($this->CurrentFont[
'kerninfo'][$ulastc[0]][$uc[0]])) {
7909 $cw += ($this->CurrentFont[
'kerninfo'][$ulastc[0]][$uc[0]] * $this->FontSizePt / 1000 );
7915 $cw += $lbw * Mpdf::SCALE;
7916 $contentB[(count($contentB) - 1)] .=
'L';
7918 if ($i == ($clen - 1)) {
7919 $cw += $rbw * Mpdf::SCALE;
7920 $contentB[(count($contentB) - 1)] .=
'R';
7924 $contentWidth +=
$cw;
7929 $WidthCorrection = 0;
7930 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && isset($this->blk[$this->blklvl][
'text_indent']) && ($lineCount == 0) && (!$is_table) && ($align !=
'C')) {
7931 $ti = $this->sizeConverter->convert($this->blk[$this->blklvl][
'text_indent'], $this->blk[$this->blklvl][
'inner_width'], $this->blk[$this->blklvl][
'InlineProperties'][
'size'],
false);
7932 $WidthCorrection = ($ti * Mpdf::SCALE);
7935 foreach ($this->objectbuffer as $k => $objattr) {
7936 if ($objattr[
'type'] ==
'dottab') {
7937 $WidthCorrection -= ($objattr[
'outdent'] * Mpdf::SCALE);
7947 if (count($this->floatDivs)) {
7948 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($this->blklvl);
7950 $fpaddingR = $r_width;
7953 $fpaddingL = $l_width;
7958 $usey = $this->y + 0.002;
7959 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 0)) {
7960 $usey += $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'];
7965 if (isset($this->floatmargins[
'R']) && $usey <= $this->floatmargins[
'R'][
'y1'] && $usey >= $this->floatmargins[
'R'][
'y0'] && !$this->floatmargins[
'R'][
'skipline']) {
7966 $fpaddingR += $this->floatmargins[
'R'][
'w'];
7968 if (isset($this->floatmargins[
'L']) && $usey <= $this->floatmargins[
'L'][
'y1'] && $usey >= $this->floatmargins[
'L'][
'y0'] && !$this->floatmargins[
'L'][
'skipline']) {
7969 $fpaddingL += $this->floatmargins[
'L'][
'w'];
7975 if (( $contentWidth +
$cw > $maxWidth - $WidthCorrection - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) ) + 0.001)) {
7981 $savedContentB =
'';
7985 $savedPreOTLdata = [];
7986 $savedPreContent = [];
7987 $savedPreContentB = [];
7995 $breakfound =
false;
7996 $contentctr = count($content) - 1;
7997 if ($this->usingCoreFont) {
7998 $charctr = strlen($currContent);
8000 $charctr = mb_strlen($currContent, $this->mb_enc);
8003 $prevchar = $this->_getPrevChar($contentctr, $charctr, $content);
8008 if ($CJKoverflow || $Oikomi) {
8009 $CJKoverflow =
false;
8013 if (!$this->usingCoreFont && !$breakfound && $this->checkCJK) {
8016 $followingchar =
'';
8017 if ($i < ($clen - 1)) {
8018 if ($this->usingCoreFont) {
8019 $followingchar = $s[$i + 1];
8021 $followingchar = mb_substr($s, $i + 1, 1, $this->mb_enc);
8026 if (preg_match(
"/[" . $this->pregCJKchars .
"]/u", $prevchar) && preg_match(
"/[" . $this->CJKoverflow .
"]/u", $checkchar) && $this->allowCJKorphans) {
8029 $contentWidth +=
$cw;
8030 $CJKoverflow =
true;
8032 } elseif (preg_match(
"/[" . $this->pregCJKchars .
"]/u", $checkchar) && $this->allowCJKorphans &&
8033 (preg_match(
"/[" . $this->CJKleading .
"]/u", $followingchar) || preg_match(
"/[" . $this->CJKfollowing .
"]/u", $checkchar)) &&
8034 !preg_match(
"/[" . $this->CJKleading .
"]/u", $checkchar) && !preg_match(
"/[" . $this->CJKfollowing .
"]/u", $followingchar) &&
8035 !(preg_match(
"/[0-9\x{ff10}-\x{ff19}]/u", $followingchar) && preg_match(
"/[0-9\x{ff10}-\x{ff19}]/u", $checkchar))) {
8041 $contentWidth +=
$cw;
8051 if (isset($this->textparam[
'hyphens']) && $this->textparam[
'hyphens'] == 1) {
8054 for ($ac = $charctr - 1; $ac >= 0; $ac--) {
8055 if ($this->usingCoreFont) {
8056 $addc = substr($currContent, $ac, 1);
8058 $addc = mb_substr($currContent, $ac, 1, $this->mb_enc);
8063 $currWord = $addc . $currWord;
8066 for ($ac = $i; $ac < ($clen - 1); $ac++) {
8067 if ($this->usingCoreFont) {
8068 $addc = substr($s, $ac, 1);
8070 $addc = mb_substr($s, $ac, 1, $this->mb_enc);
8077 $ptr = $this->hyphenator->hyphenateWord($currWord, $charctr - $start);
8079 $breakfound = [$contentctr, $start + $ptr, $contentctr, $start + $ptr,
'hyphen'];
8085 while ($breakfound ==
false && $prevchar !==
false) {
8086 $cutcontentctr = $contentctr;
8087 $cutcharctr = $charctr;
8088 $prevchar = $this->_moveToPrevChar($contentctr, $charctr, $content);
8092 if ($prevchar ==
' ') {
8093 $breakfound = [$contentctr, $charctr, $cutcontentctr, $cutcharctr,
'discard'];
8097 elseif ($prevchar ==
"\xe2\x80\x8b") {
8098 $breakfound = [$contentctr, $charctr, $cutcontentctr, $cutcharctr,
'discard'];
8102 elseif (isset($this->textparam[
'hyphens']) && $this->textparam[
'hyphens'] != 2 && ($prevchar ==
'-' || $prevchar ==
"\xe2\x80\x90")) {
8106 for ($ac = $charctr - 1; $ac >= 0; $ac--) {
8107 if ($this->usingCoreFont) {
8108 $addc = substr($currContent, $ac, 1);
8110 $addc = mb_substr($currContent, $ac, 1, $this->mb_enc);
8115 $checkw = $addc . $checkw;
8118 if ((!preg_match(
'/(http:|ftp:|https:|www\.)/', $checkw) && $checkchar !=
'>' && !preg_match(
'/[0-9]/', $checkchar)) || $prevchar ==
"\xe2\x80\x90") {
8119 $breakfound = [$cutcontentctr, $cutcharctr, $cutcontentctr, $cutcharctr,
'cut'];
8124 elseif (isset($this->textparam[
'hyphens']) && $this->textparam[
'hyphens'] != 2 && !$this->usingCoreFont && $prevchar ==
"\xc2\xad") {
8125 $breakfound = [$cutcontentctr, $cutcharctr, $cutcontentctr, $cutcharctr,
'cut'];
8126 $content[$contentctr] = mb_substr($content[$contentctr], 0, $charctr, $this->mb_enc) .
'-' . mb_substr($content[$contentctr], $charctr + 1, mb_strlen($content[$contentctr]), $this->mb_enc);
8127 if (!empty($cOTLdata[$contentctr])) {
8128 $cOTLdata[$contentctr][
'char_data'][$charctr] = [
'bidi_class' => 9,
'uni' => 45];
8129 $cOTLdata[$contentctr][
'group'][$charctr] =
'C';
8131 } elseif (isset($this->textparam[
'hyphens']) && $this->textparam[
'hyphens'] != 2 && $this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats' && $prevchar == chr(173)) {
8132 $breakfound = [$cutcontentctr, $cutcharctr, $cutcontentctr, $cutcharctr,
'cut'];
8133 $content[$contentctr] = substr($content[$contentctr], 0, $charctr) .
'-' . substr($content[$contentctr], $charctr + 1);
8139 elseif (!$this->usingCoreFont && $this->checkCJK && preg_match(
"/[" . $this->pregCJKchars .
"]/u", $checkchar) &&
8140 !preg_match(
"/[" . $this->CJKfollowing .
"]/u", $checkchar) && !preg_match(
"/[" . $this->CJKleading .
"]/u", $prevchar) &&
8141 !(preg_match(
"/[0-9\x{ff10}-\x{ff19}]/u", $prevchar) && preg_match(
"/[0-9\x{ff10}-\x{ff19}]/u", $checkchar))) {
8142 $breakfound = [$cutcontentctr, $cutcharctr, $cutcontentctr, $cutcharctr,
'cut'];
8148 if (isset($this->objectbuffer[$contentctr])) {
8149 $breakfound = [$cutcontentctr, $cutcharctr, $cutcontentctr, $cutcharctr,
'cut'];
8153 $checkchar = $prevchar;
8157 if (is_array($breakfound)) {
8158 $contentctr = $breakfound[0];
8159 $charctr = $breakfound[1];
8160 $cutcontentctr = $breakfound[2];
8161 $cutcharctr = $breakfound[3];
8162 $type = $breakfound[4];
8164 for ($ix = count($content) - 1; $ix > $cutcontentctr; $ix--) {
8167 if (!empty($sOTLdata)) {
8168 $tmpOTL = array_pop($cOTLdata);
8169 $savedPreOTLdata[] = $tmpOTL;
8172 $savedPreContent[] = array_pop($content);
8173 $savedPreContentB[] = array_pop($contentB);
8174 $savedPreFont[] = array_pop($font);
8178 if ($this->usingCoreFont) {
8179 $savedPreContent[] = substr($content[$cutcontentctr], $cutcharctr);
8181 $savedPreContent[] = mb_substr($content[$cutcontentctr], $cutcharctr, mb_strlen($content[$cutcontentctr]), $this->mb_enc);
8183 $savedPreContentB[] = preg_replace(
'/L/',
'', $contentB[$cutcontentctr]);
8184 $savedPreFont[] = $font[$cutcontentctr];
8186 if (!empty($sOTLdata)) {
8187 $savedPreOTLdata[] = $this->otl->splitOTLdata($cOTLdata[$cutcontentctr], $cutcharctr, $cutcharctr);
8193 if ($cutcharctr == 0 && $type ==
'discard') {
8194 array_pop($content);
8195 array_pop($contentB);
8197 array_pop($cOTLdata);
8200 $currContent = & $content[count($content) - 1];
8201 if ($this->usingCoreFont) {
8202 $currContent = substr($currContent, 0, $charctr);
8204 $currContent = mb_substr($currContent, 0, $charctr, $this->mb_enc);
8207 if (!empty($sOTLdata)) {
8208 $savedPreOTLdata[] = $this->otl->splitOTLdata($cOTLdata[(count($cOTLdata) - 1)], mb_strlen($currContent, $this->mb_enc));
8211 if (strpos($contentB[(count($contentB) - 1)],
'R') !==
false) {
8212 $contentB[count($content) - 1] = preg_replace(
'/R/',
'', $contentB[count($content) - 1]);
8215 if ($type ==
'hyphen') {
8216 $currContent .=
'-';
8217 if (!empty($cOTLdata[(count($cOTLdata) - 1)])) {
8218 $cOTLdata[(count($cOTLdata) - 1)][
'char_data'][] = [
'bidi_class' => 9,
'uni' => 45];
8219 $cOTLdata[(count($cOTLdata) - 1)][
'group'] .=
'C';
8224 $savedContentB =
'';
8233 if (!is_array($breakfound)) {
8234 $savedFont = $this->saveFont();
8235 if (!empty($sOTLdata)) {
8236 $savedOTLdata = $this->otl->splitOTLdata($cOTLdata[(count($cOTLdata) - 1)], mb_strlen($currContent, $this->mb_enc));
8240 if ($content[count($content) - 1] ==
'' && !isset($this->objectbuffer[count($content) - 1])) {
8241 array_pop($content);
8242 array_pop($contentB);
8244 array_pop($cOTLdata);
8245 $currContent = & $content[count($content) - 1];
8250 $currContent = $currContent ? rtrim($currContent) :
'';
8251 if ($this->checkCJK) {
8252 $currContent = preg_replace(
"/\xe3\x80\x80$/",
'', $currContent);
8255 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
8256 $this->otl->trimOTLdata($cOTLdata[count($cOTLdata) - 1],
false,
true);
8262 if (isset($this->objectbuffer[(count($content) - 1)]) && (!isset($type) || $type !=
'discard')) {
8263 $objtype = $this->objectbuffer[(count($content) - 1)][
'type'];
8264 if ($objtype ==
'dottab' || $objtype ==
'bookmark' || $objtype ==
'indexentry' || $objtype ==
'toc' || $objtype ==
'annot') {
8265 $savedObj = array_pop($this->objectbuffer);
8271 if ($is_table && substr($align, 0, 1) ==
'D') {
8272 $align = substr($align, 2, 1);
8277 $this->_setInlineBlockHeights($lineBox, $stackHeight, $content, $font, $is_table);
8282 $inclCursive =
false;
8283 foreach ($content as $k => $chunk) {
8284 if (isset($this->objectbuffer[$k]) && $this->objectbuffer[$k]) {
8286 if ($this->objectbuffer[$k][
'type'] ==
'image' && isset($this->objectbuffer[$k][
'listmarker']) && $this->objectbuffer[$k][
'listmarker']) {
8287 if ($this->objectbuffer[$k][
'listmarkerposition'] !=
'outside') {
8288 $contentWidth += $this->objectbuffer[$k][
'OUTER-WIDTH'] * Mpdf::SCALE;
8291 $contentWidth += $this->objectbuffer[$k][
'OUTER-WIDTH'] * Mpdf::SCALE;
8293 } elseif (!isset($this->objectbuffer[$k]) || (isset($this->objectbuffer[$k]) && !$this->objectbuffer[$k])) {
8294 $this->restoreFont($font[$k],
false);
8295 if ($this->checkCJK && $k == count($content) - 1 && $CJKoverflow && $align ==
'J' && $this->allowCJKoverflow && $this->CJKforceend) {
8297 $hanger = mb_substr($chunk, mb_strlen($chunk, $this->mb_enc) - 1, 1, $this->mb_enc);
8299 $content[$k] = $chunk = mb_substr($chunk, 0, mb_strlen($chunk, $this->mb_enc) - 1, $this->mb_enc);
8303 if (!$this->usingCoreFont) {
8305 if ((isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) || !empty($sOTLdata)) {
8306 $this->otl->removeChar($chunk, $cOTLdata[$k],
"\xc2\xad");
8307 $this->otl->replaceSpace($chunk, $cOTLdata[$k]);
8308 if (preg_match(
"/([" . $this->pregCURSchars .
"])/u", $chunk)) {
8309 $inclCursive =
true;
8311 $content[$k] = $chunk;
8313 $content[$k] = $chunk = str_replace(
"\xc2\xad",
'', $chunk);
8314 $content[$k] = $chunk = str_replace(chr(194) . chr(160), chr(32), $chunk);
8316 } elseif ($this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats') {
8317 $content[$k] = $chunk = str_replace(chr(173),
'', $chunk);
8318 $content[$k] = $chunk = str_replace(chr(160), chr(32), $chunk);
8321 $contentWidth += $this->GetStringWidth($chunk,
true, (isset($cOTLdata[$k]) ? $cOTLdata[$k] :
false), $this->textvar) * Mpdf::SCALE;
8322 if (!empty($this->spanborddet)) {
8323 if (isset($this->spanborddet[
'L'][
'w']) && strpos($contentB[$k],
'L') !==
false) {
8324 $contentWidth += $this->spanborddet[
'L'][
'w'] * Mpdf::SCALE;
8326 if (isset($this->spanborddet[
'R'][
'w']) && strpos($contentB[$k],
'R') !==
false) {
8327 $contentWidth += $this->spanborddet[
'R'][
'w'] * Mpdf::SCALE;
8333 $lastfontreqstyle = (isset($font[count($font) - 1][
'ReqFontStyle']) ? $font[count($font) - 1][
'ReqFontStyle'] :
'');
8334 $lastfontstyle = (isset($font[count($font) - 1][
'style']) ? $font[count($font) - 1][
'style'] :
'');
8335 if ($blockdir ==
'ltr' && strpos($lastfontreqstyle,
"I") !==
false && strpos($lastfontstyle,
"I") ===
false) {
8336 $lastitalic = $this->FontSize * 0.15 * Mpdf::SCALE;
8345 if (!$table_draft) {
8347 $chunkorder = range(0, count($content) - 1);
8350 if ($blockdir ==
'rtl' || $this->biDirectional) {
8351 $this->otl->bidiReorder($chunkorder, $content, $cOTLdata, $blockdir);
8358 foreach ($chunkorder as $aord => $k) {
8359 if (count($cOTLdata)) {
8360 $this->restoreFont($font[$k],
false);
8362 if ($aord == count($chunkorder) - 1 && isset($cOTLdata[$aord][
'group'])) {
8363 $nGPOS = strlen($cOTLdata[$aord][
'group']) - 1;
8364 if (isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL']) || isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'])) {
8365 if (isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'])) {
8366 $w = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
8368 $w = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
8370 $w *= ($this->FontSize / 1000);
8371 $contentWidth -= $w * Mpdf::SCALE;
8372 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'] = 0;
8373 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'] = 0;
8377 if (isset($cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'])) {
8378 $w = -$cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'] * 1000 / $this->CurrentFont[
'unitsPerEm'];
8379 $w *= ($this->FontSize / 1000);
8380 $contentWidth -= $w * Mpdf::SCALE;
8381 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceL'] = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'];
8382 $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XAdvanceR'] = $cOTLdata[$aord][
'GPOSinfo'][$nGPOS][
'XPlacement'];
8395 if (($align ==
'J' && !$CJKoverflow) || (($contentWidth + $lastitalic > $maxWidth - $WidthCorrection - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) ) + 0.001) && (!$CJKoverflow || ($CJKoverflow && !$this->allowCJKoverflow))) || $CJKoverflow && $align ==
'J' && $this->allowCJKoverflow && $hanger && $this->CJKforceend) {
8399 foreach ($chunkorder as $aord => $k) {
8400 $chunk = isset($content[$aord]) ? $content[$aord] :
'';
8401 if (!isset($this->objectbuffer[$k]) || (isset($this->objectbuffer[$k]) && !$this->objectbuffer[$k])) {
8402 $nb_carac += mb_strlen($chunk, $this->mb_enc);
8403 $nb_spaces += mb_substr_count($chunk,
' ', $this->mb_enc);
8405 if (isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF)) {
8406 if (isset($cOTLdata[$aord][
'group']) && $cOTLdata[$aord][
'group']) {
8407 $nb_carac -= substr_count($cOTLdata[$aord][
'group'],
'M');
8415 list($jcharspacing, $jws, $jkashida) = $this->GetJspacing($nb_carac, $nb_spaces, ($maxWidth - $lastitalic - $contentWidth - $WidthCorrection - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) )), $inclCursive, $cOTLdata);
8419 $empty = $maxWidth - $lastitalic - $WidthCorrection - $contentWidth - (($this->cMarginL + $this->cMarginR) * Mpdf::SCALE) - ($paddingL + $paddingR + (($fpaddingL + $fpaddingR) * Mpdf::SCALE) );
8421 $empty -= ($jcharspacing * ($nb_carac - 1));
8422 $empty -= ($jws * $nb_spaces);
8423 $empty -= ($jkashida);
8424 $empty /= Mpdf::SCALE;
8428 $check_h = max($this->divheight, $stackHeight);
8429 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($this->blklvl > 0) && ($lineCount == 1) && (!$is_table)) {
8430 $check_h += ($this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'border_top'][
'w']);
8433 if ($this->ColActive && $check_h > ($this->PageBreakTrigger - $this->y0)) {
8434 $this->SetCol($this->NbCol - 1);
8439 if (!$is_table && ($this->y + $check_h) > $this->PageBreakTrigger and ! $this->InFooter and $this->AcceptPageBreak()) {
8443 $charspacing = $this->charspacing;
8444 $this->ResetSpacing();
8446 $this->
AddPage($this->CurOrientation);
8450 $currentx += $this->MarginCorrection;
8451 $this->x += $this->MarginCorrection;
8454 $this->SetSpacing($charspacing, $ws);
8457 if ($this->kwt && !$is_table) {
8458 $this->printkwtbuffer();
8466 if ($this->CurrCol != $oldcolumn) {
8467 $currentx += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
8468 $this->x += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
8469 $oldcolumn = $this->CurrCol;
8472 if ($this->ColActive && !$is_table) {
8473 $this->breakpoints[$this->CurrCol][] = $this->y;
8478 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($this->blk[$this->blklvl][
'margin_top']) && ($lineCount == 1) && (!$is_table)) {
8479 $this->DivLn($this->blk[$this->blklvl][
'margin_top'], $this->blklvl - 1,
true, $this->blk[$this->blklvl][
'margin_collapse']);
8480 if ($this->ColActive) {
8481 $this->breakpoints[$this->CurrCol][] = $this->y;
8487 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 1) && (!$is_table)) {
8488 $this->blk[$this->blklvl][
'y0'] = $this->y;
8489 $this->blk[$this->blklvl][
'startpage'] = $this->page;
8490 if ($this->blk[$this->blklvl][
'float']) {
8491 $this->blk[$this->blklvl][
'float_start_y'] = $this->y;
8496 if (($newblock) && ($blockstate == 1 || $blockstate == 3) && (($this->blk[$this->blklvl][
'padding_top']) || ($this->blk[$this->blklvl][
'border_top'])) && ($lineCount == 1) && (!$is_table)) {
8498 $this->DivLn($this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'], -3,
true,
false, 1);
8499 if ($this->ColActive) {
8500 $this->breakpoints[$this->CurrCol][] = $this->y;
8504 $arraysize = count($chunkorder);
8506 $margins = ($this->cMarginL + $this->cMarginR) + ($ipaddingL + $ipaddingR + $fpaddingR + $fpaddingR );
8510 $this->DivLn($stackHeight, $this->blklvl,
false);
8513 $this->x = $currentx + $this->cMarginL + $ipaddingL + $fpaddingL;
8514 if ($align ==
'R') {
8516 } elseif ($align ==
'C') {
8517 $this->x += ($empty / 2);
8521 if (isset($this->blk[$this->blklvl][
'text_indent']) && ($newblock) && ($blockstate == 1 || $blockstate == 3) && ($lineCount == 1) && (!$is_table) && ($blockdir !=
'rtl') && ($align !=
'C')) {
8522 $ti = $this->sizeConverter->convert($this->blk[$this->blklvl][
'text_indent'], $this->blk[$this->blklvl][
'inner_width'], $this->blk[$this->blklvl][
'InlineProperties'][
'size'],
false);
8527 foreach ($chunkorder as $aord => $k) {
8529 $chunk = isset($content[$aord]) ? $content[$aord] :
'';
8531 if (isset($this->objectbuffer[$k]) && $this->objectbuffer[$k]) {
8532 $xadj = $this->x - $this->objectbuffer[$k][
'OUTER-X'];
8533 $this->objectbuffer[$k][
'OUTER-X'] += $xadj;
8534 $this->objectbuffer[$k][
'BORDER-X'] += $xadj;
8535 $this->objectbuffer[$k][
'INNER-X'] += $xadj;
8537 if ($this->objectbuffer[$k][
'type'] ==
'listmarker') {
8538 $this->objectbuffer[$k][
'lineBox'] = $lineBox[-1];
8540 $yadj = $this->y - $this->objectbuffer[$k][
'OUTER-Y'];
8541 if ($this->objectbuffer[$k][
'type'] ==
'dottab') {
8542 $this->objectbuffer[$k][
'lineBox'] = $lineBox[$k];
8544 if ($this->objectbuffer[$k][
'type'] !=
'dottab') {
8545 $yadj += $lineBox[$k][
'top'];
8547 $this->objectbuffer[$k][
'OUTER-Y'] += $yadj;
8548 $this->objectbuffer[$k][
'BORDER-Y'] += $yadj;
8549 $this->objectbuffer[$k][
'INNER-Y'] += $yadj;
8552 $this->restoreFont($font[$k]);
8554 $this->SetSpacing(($this->fixedlSpacing * Mpdf::SCALE) + $jcharspacing, ($this->fixedlSpacing + $this->minwSpacing) * Mpdf::SCALE + $jws);
8556 $this->fixedlSpacing =
false;
8557 $this->minwSpacing = 0;
8559 $save_vis = $this->visibility;
8560 if (isset($this->textparam[
'visibility']) && $this->textparam[
'visibility'] && $this->textparam[
'visibility'] != $this->visibility) {
8561 $this->SetVisibility($this->textparam[
'visibility']);
8564 if ($this->spanbgcolor) {
8565 $cor = $this->spanbgcolorarray;
8566 $this->SetFColor($cor);
8571 if (!empty($this->spanborddet)) {
8572 if (strpos($contentB[$k],
'L') !==
false) {
8573 $this->x += (isset($this->spanborddet[
'L'][
'w']) ? $this->spanborddet[
'L'][
'w'] : 0);
8575 if (strpos($contentB[$k],
'L') ===
false) {
8576 $this->spanborddet[
'L'][
's'] = $this->spanborddet[
'L'][
'w'] = 0;
8578 if (strpos($contentB[$k],
'R') ===
false) {
8579 $this->spanborddet[
'R'][
's'] = $this->spanborddet[
'R'][
'w'] = 0;
8585 $stringWidth = $this->GetStringWidth($chunk,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar,
true);
8587 $nch = mb_strlen($chunk, $this->mb_enc);
8589 if (isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0xFF)) {
8590 if (isset($cOTLdata[$aord][
'group']) && $cOTLdata[$aord][
'group']) {
8591 $nch -= substr_count($cOTLdata[$aord][
'group'],
'M');
8594 $stringWidth += ( $this->charspacing * $nch / Mpdf::SCALE );
8596 $stringWidth += ( $this->ws * mb_substr_count($chunk,
' ', $this->mb_enc) / Mpdf::SCALE );
8598 if (isset($this->objectbuffer[$k])) {
8600 if ($this->objectbuffer[$k][
'type'] ==
'image' && isset($this->objectbuffer[$k][
'listmarker']) && $this->objectbuffer[$k][
'listmarker'] && $this->objectbuffer[$k][
'listmarkerposition'] ==
'outside') {
8603 $stringWidth = $this->objectbuffer[$k][
'OUTER-WIDTH'];
8607 if ($stringWidth == 0) {
8608 $stringWidth = 0.000001;
8611 if ($aord == $arraysize - 1) {
8612 $stringWidth -= ( $this->charspacing / Mpdf::SCALE );
8613 if ($this->checkCJK && $CJKoverflow && $align ==
'J' && $this->allowCJKoverflow && $hanger && $this->CJKforceend) {
8615 $this->Cell($stringWidth, $stackHeight, $chunk,
'', 0,
'', $fill, $this->HREF, $currentx, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
8616 $this->Cell($this->GetStringWidth($hanger), $stackHeight, $hanger,
'', 1,
'', $fill, $this->HREF, $currentx, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
8618 $this->Cell($stringWidth, $stackHeight, $chunk,
'', 1,
'', $fill, $this->HREF, $currentx, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
8621 $this->Cell($stringWidth, $stackHeight, $chunk,
'', 0,
'', $fill, $this->HREF, 0, 0, 0,
'M', $fill,
true, (isset($cOTLdata[$aord]) ? $cOTLdata[$aord] :
false), $this->textvar, (isset($lineBox[$k]) ? $lineBox[$k] :
false));
8624 if (!empty($this->spanborddet)) {
8625 if (strpos($contentB[$k],
'R') !==
false && $aord != $arraysize - 1) {
8626 $this->x += $this->spanborddet[
'R'][
'w'];
8630 if (isset($spanfill) && $spanfill) {
8634 $this->SetFColor($bcor);
8637 if (isset($this->textparam[
'visibility']) && $this->textparam[
'visibility'] && $this->visibility != $save_vis) {
8638 $this->SetVisibility($save_vis);
8641 } elseif ($table_draft) {
8642 $this->y += $stackHeight;
8646 $this->maxPosR = max($this->maxPosR, ($this->w - $this->rMargin - $this->blk[$this->blklvl][
'outer_right_margin']));
8647 $this->maxPosL = min($this->maxPosL, ($this->lMargin + $this->blk[$this->blklvl][
'outer_left_margin']));
8652 if (!$table_draft) {
8653 $this->printobjectbuffer($is_table, $blockdir);
8655 $this->objectbuffer = [];
8660 if ($this->floatmargins) {
8661 $this->_advanceFloatMargins();
8666 $stackHeight = $this->divheight;
8674 if (!empty($savedObj)) {
8675 $this->objectbuffer[] = $savedObj;
8676 $font[] = $savedFont;
8680 $contentWidth += $savedObj[
'OUTER-WIDTH'] * Mpdf::SCALE;
8682 if (count($savedPreContent) > 0) {
8683 for ($ix = count($savedPreContent) - 1; $ix >= 0; $ix--) {
8684 $font[] = $savedPreFont[$ix];
8685 $content[] = $savedPreContent[$ix];
8686 $contentB[] = $savedPreContentB[$ix];
8687 if (!empty($sOTLdata)) {
8688 $cOTLdata[] = $savedPreOTLdata[$ix];
8690 $this->restoreFont($savedPreFont[$ix]);
8692 if (!empty($this->spanborddet)) {
8693 $lbw = (isset($this->spanborddet[
'L'][
'w']) ? $this->spanborddet[
'L'][
'w'] : 0);
8694 $rbw = (isset($this->spanborddet[
'R'][
'w']) ? $this->spanborddet[
'R'][
'w'] : 0);
8697 $contentWidth += $this->GetStringWidth($savedPreContent[$ix],
true, (isset($savedPreOTLdata[$ix]) ? $savedPreOTLdata[$ix] :
false), $this->textvar) * Mpdf::SCALE;
8698 if (strpos($savedPreContentB[$ix],
'L') !==
false) {
8699 $contentWidth += $lbw;
8701 if (strpos($savedPreContentB[$ix],
'R') !==
false) {
8702 $contentWidth += $rbw;
8706 $savedPreContent = [];
8707 $savedPreContentB = [];
8708 $savedPreOTLdata = [];
8710 $content[(count($content) - 1)] .= $c;
8712 $font[] = $savedFont;
8713 $content[] = $savedContent . $c;
8714 $contentB[] = $savedContentB;
8715 $cOTLdata[] = $savedOTLdata;
8718 $currContent = & $content[(count($content) - 1)];
8719 $this->restoreFont($font[(count($font) - 1)]);
8724 if ($this->checkCJK && $currContent ==
"\xe3\x80\x80") {
8726 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
8727 $this->otl->trimOTLdata($cOTLdata[count($cOTLdata) - 1],
true,
false);
8733 if (!empty($this->spanborddet)) {
8734 $lbw = (isset($this->spanborddet[
'L'][
'w']) ? $this->spanborddet[
'L'][
'w'] : 0);
8735 $rbw = (isset($this->spanborddet[
'R'][
'w']) ? $this->spanborddet[
'R'][
'w'] : 0);
8738 $contentWidth += $this->GetStringWidth($currContent,
false, (isset($cOTLdata[(count($cOTLdata) - 1)]) ? $cOTLdata[(count($cOTLdata) - 1)] :
false), $this->textvar) * Mpdf::SCALE;
8739 if (strpos($savedContentB,
'L') !==
false) {
8740 $contentWidth += $lbw;
8742 $CJKoverflow =
false;
8746 $contentWidth +=
$cw;
8763 if (isset($this->floatmargins[
'L']) && $this->floatmargins[
'L'][
'skipline'] && $this->floatmargins[
'L'][
'y0'] != $this->y) {
8764 $yadj = $this->y - $this->floatmargins[
'L'][
'y0'];
8765 $this->floatmargins[
'L'][
'y0'] = $this->y;
8766 $this->floatmargins[
'L'][
'y1'] += $yadj;
8769 if ($this->floatbuffer[$this->floatmargins[
'L'][
'id']][
'border_left'][
'w']) {
8770 $this->floatbuffer[$this->floatmargins[
'L'][
'id']][
'BORDER-Y'] += $yadj;
8772 $this->floatbuffer[$this->floatmargins[
'L'][
'id']][
'INNER-Y'] += $yadj;
8773 $this->floatbuffer[$this->floatmargins[
'L'][
'id']][
'OUTER-Y'] += $yadj;
8776 $this->floatbuffer[$this->floatmargins[
'L'][
'id']][
'skipline'] =
false;
8777 $this->floatmargins[
'L'][
'skipline'] =
false;
8778 $this->floatmargins[
'L'][
'id'] =
'';
8781 if (isset($this->floatmargins[
'R']) && $this->floatmargins[
'R'][
'skipline'] && $this->floatmargins[
'R'][
'y0'] != $this->y) {
8782 $yadj = $this->y - $this->floatmargins[
'R'][
'y0'];
8783 $this->floatmargins[
'R'][
'y0'] = $this->y;
8784 $this->floatmargins[
'R'][
'y1'] += $yadj;
8787 if ($this->floatbuffer[$this->floatmargins[
'R'][
'id']][
'border_left'][
'w']) {
8788 $this->floatbuffer[$this->floatmargins[
'R'][
'id']][
'BORDER-Y'] += $yadj;
8790 $this->floatbuffer[$this->floatmargins[
'R'][
'id']][
'INNER-Y'] += $yadj;
8791 $this->floatbuffer[$this->floatmargins[
'R'][
'id']][
'OUTER-Y'] += $yadj;
8794 $this->floatbuffer[$this->floatmargins[
'R'][
'id']][
'skipline'] =
false;
8795 $this->floatmargins[
'R'][
'skipline'] =
false;
8796 $this->floatmargins[
'R'][
'id'] =
'';
8808 if (!(($mode == 0) || ($mode == 1) || ($mode == 2))) {
8809 throw new \Mpdf\MpdfException(
"Text rendering mode should be 0, 1 or 2 (value : $mode)");
8811 $tr = ($mode .
' Tr');
8812 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'TextRendering']) && $this->pageoutput[$this->page][
'TextRendering'] != $tr) || !isset($this->pageoutput[$this->page][
'TextRendering']))) {
8813 $this->writer->write($tr);
8815 $this->pageoutput[$this->page][
'TextRendering'] = $tr;
8822 $this->SetDColor(
$params[
'outline-COLOR']);
8824 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'TextRendering']) && $this->pageoutput[$this->page][
'TextRendering'] != $tr) || !isset($this->pageoutput[$this->page][
'TextRendering']))) {
8825 $this->writer->write($tr);
8827 $this->pageoutput[$this->page][
'TextRendering'] = $tr;
8830 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
8831 $this->_SetTextRendering(0);
8833 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'TextRendering']) && $this->pageoutput[$this->page][
'TextRendering'] != $tr) || !isset($this->pageoutput[$this->page][
'TextRendering']))) {
8834 $this->writer->write($tr);
8836 $this->pageoutput[$this->page][
'TextRendering'] = $tr;
8840 function Image($file, $x, $y, $w = 0, $h = 0, $type =
'', $link =
'', $paint =
true, $constrain =
true, $watermark =
false, $shownoimg =
true, $allowvector =
true)
8842 $orig_srcpath = $file;
8843 $this->GetFullPath($file);
8845 $info = $this->imageProcessor->getImage($file,
true, $allowvector, $orig_srcpath);
8846 if (!$info && $paint) {
8847 $info = $this->imageProcessor->getImage($this->noImageFile);
8849 $file = $this->noImageFile;
8850 $w = ($info[
'w'] * (25.4 / $this->img_dpi));
8851 $h = ($info[
'h'] * (25.4 / $this->img_dpi));
8858 if ($w == 0 and $h == 0) {
8860 if ($info[
'type'] ==
'wmf') {
8864 $w = abs($info[
'w']) / (20 * Mpdf::SCALE);
8865 $h = abs($info[
'h']) / (20 * Mpdf::SCALE);
8867 if ($info[
'type'] ==
'svg') {
8870 $w = abs($info[
'w']) / Mpdf::SCALE;
8871 $h = abs($info[
'h']) / Mpdf::SCALE;
8874 $w = ($info[
'w'] / Mpdf::SCALE) * (72 / $this->img_dpi);
8875 $h = ($info[
'h'] / Mpdf::SCALE) * (72 / $this->img_dpi);
8880 $w = abs($h * $info[
'w'] / $info[
'h']);
8883 $h = abs($w * $info[
'h'] / $info[
'w']);
8891 if (is_array($this->watermark_size)) {
8892 $w = $this->watermark_size[0];
8893 $h = $this->watermark_size[1];
8894 } elseif (!is_string($this->watermark_size)) {
8895 $maxw -= $this->watermark_size * 2;
8896 $maxh -= $this->watermark_size * 2;
8898 $h = abs($w * $info[
'h'] / $info[
'w']);
8901 $w = abs($h * $info[
'w'] / $info[
'h']);
8903 } elseif ($this->watermark_size ==
'F') {
8904 if ($this->ColActive) {
8905 $maxw = $this->w - ($this->DeflMargin + $this->DefrMargin);
8907 $maxw = $this->pgwidth;
8909 $maxh = $this->h - ($this->tMargin + $this->bMargin);
8911 $h = abs($w * $info[
'h'] / $info[
'w']);
8914 $w = abs($h * $info[
'w'] / $info[
'h']);
8916 } elseif ($this->watermark_size ==
'P') {
8918 $h = abs($w * $info[
'h'] / $info[
'w']);
8921 $w = abs($h * $info[
'w'] / $info[
'h']);
8927 $h = abs($w * $info[
'h'] / $info[
'w']);
8931 $w = abs($h * $info[
'w'] / $info[
'h']);
8934 if (is_array($this->watermark_pos)) {
8935 $x = $this->watermark_pos[0];
8936 $y = $this->watermark_pos[1];
8937 } elseif ($this->watermark_pos ==
'F') {
8938 if ($this->ColActive) {
8939 if (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
8940 $xadj = $this->DeflMargin - $this->DefrMargin;
8945 $x = ($this->DeflMargin - $xadj + ($this->w - ($this->DeflMargin + $this->DefrMargin)) / 2) - ($w / 2);
8948 $x = ($this->lMargin + ($this->pgwidth) / 2) - ($w / 2);
8950 $y = ($this->tMargin + ($this->h - ($this->tMargin + $this->bMargin)) / 2) - ($h / 2);
8952 $x = ($this->w / 2) - ($w / 2);
8953 $y = ($this->h / 2) - ($h / 2);
8956 if ($info[
'type'] ==
'wmf') {
8957 $sx = $w * Mpdf::SCALE / $info[
'w'];
8958 $sy = -$h * Mpdf::SCALE / $info[
'h'];
8959 $outstring = sprintf(
'q %.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, $sy, $x * Mpdf::SCALE - $sx * $info[
'x'], (($this->h - $y) * Mpdf::SCALE) - $sy * $info[
'y'], $info[
'i']);
8961 if ($info[
'type'] ==
'svg') {
8962 $sx = $w * Mpdf::SCALE / $info[
'w'];
8963 $sy = -$h * Mpdf::SCALE / $info[
'h'];
8964 $outstring = sprintf(
'q %.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, $sy, $x * Mpdf::SCALE - $sx * $info[
'x'], (($this->h - $y) * Mpdf::SCALE) - $sy * $info[
'y'], $info[
'i']);
8966 $outstring = sprintf(
"q %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q", $w * Mpdf::SCALE, $h * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($y + $h)) * Mpdf::SCALE, $info[
'i']);
8970 if ($this->watermarkImgBehind) {
8971 $outstring = $this->watermarkImgAlpha .
"\n" . $outstring .
"\n" . $this->SetAlpha(1,
'Normal',
true) .
"\n";
8972 $this->pages[$this->page] = preg_replace(
'/(___BACKGROUND___PATTERNS' . $this->uniqstr .
')/',
"\n" . $outstring .
"\n" .
'\\1', $this->pages[$this->page]);
8974 $this->writer->write($outstring);
8983 if (isset($this->blk[$this->blklvl][
'inner_width']) && $this->blk[$this->blklvl][
'inner_width']) {
8984 $maxw = $this->blk[$this->blklvl][
'inner_width'];
8986 $maxw = $this->pgwidth;
8990 $h = abs($w * $info[
'h'] / $info[
'w']);
8992 if ($h > $this->h - ($this->tMargin + $this->bMargin + 1)) {
8993 $h = $this->h - ($this->tMargin + $this->bMargin + 1);
8994 if ($this->fullImageHeight) {
8995 $h = $this->fullImageHeight;
8997 $w = abs($h * $info[
'w'] / $info[
'h']);
9003 if (($x + $w) > $this->w) {
9004 $x = $this->lMargin;
9008 $changedpage =
false;
9009 $oldcolumn = $this->CurrCol;
9011 if ($y + $h > $this->PageBreakTrigger and ! $this->InFooter and $this->AcceptPageBreak()) {
9012 $this->
AddPage($this->CurOrientation);
9014 $x = $x + $this->MarginCorrection;
9015 $y = $this->tMargin;
9016 $changedpage =
true;
9021 if ($this->CurrCol != $oldcolumn) {
9023 $x += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
9024 $this->x += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
9030 if ($info[
'type'] ==
'wmf') {
9031 $sx = $w * Mpdf::SCALE / $info[
'w'];
9032 $sy = -$h * Mpdf::SCALE / $info[
'h'];
9033 $outstring = sprintf(
'q %.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, $sy, $x * Mpdf::SCALE - $sx * $info[
'x'], (($this->h - $y) * Mpdf::SCALE) - $sy * $info[
'y'], $info[
'i']);
9035 if ($info[
'type'] ==
'svg') {
9036 $sx = $w * Mpdf::SCALE / $info[
'w'];
9037 $sy = -$h * Mpdf::SCALE / $info[
'h'];
9038 $outstring = sprintf(
'q %.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, $sy, $x * Mpdf::SCALE - $sx * $info[
'x'], (($this->h - $y) * Mpdf::SCALE) - $sy * $info[
'y'], $info[
'i']);
9040 $outstring = sprintf(
"q %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q", $w * Mpdf::SCALE, $h * Mpdf::SCALE, $x * Mpdf::SCALE, ($this->h - ($y + $h)) * Mpdf::SCALE, $info[
'i']);
9045 $this->writer->write($outstring);
9047 $this->
Link($x, $y, $w, $h, $link);
9055 $sizesarray[
'WIDTH'] = $w;
9056 $sizesarray[
'HEIGHT'] = $h;
9057 $sizesarray[
'X'] = $x;
9058 $sizesarray[
'Y'] = $y;
9059 $sizesarray[
'OUTPUT'] = $outstring;
9061 $sizesarray[
'IMAGE_ID'] = $info[
'i'];
9062 $sizesarray[
'itype'] = $info[
'type'];
9063 $sizesarray[
'set-dpi'] = (isset($info[
'set-dpi']) ? $info[
'set-dpi'] : 0);
9076 $c = explode(
"\xbb\xa4\xac", $t, 2);
9077 $c = explode(
",", $c[1], 2);
9078 foreach ($c as $v) {
9079 $v = explode(
"=", $v, 2);
9082 return (unserialize($sp[
'objattr']));
9085 function inlineObject($type, $x, $y, $objattr, $Lmargin, $widthUsed, $maxWidth, $lineHeight, $paint =
false, $is_table =
false)
9088 $k = $this->shrin_k;
9096 if (isset($objattr[
'width'])) {
9097 $w = $objattr[
'width'] / $k;
9100 if (isset($objattr[
'height'])) {
9101 $h = abs($objattr[
'height'] / $k);
9103 $widthLeft = $maxWidth - $widthUsed;
9104 $maxHeight = $this->h - ($this->tMargin + $this->bMargin + 10);
9105 if ($this->fullImageHeight) {
9106 $maxHeight = $this->fullImageHeight;
9109 if (isset($objattr[
'border_left'])) {
9110 $extraWidth = ($objattr[
'border_left'][
'w'] + $objattr[
'border_right'][
'w'] + $objattr[
'margin_left'] + $objattr[
'margin_right']) / $k;
9111 $extraHeight = ($objattr[
'border_top'][
'w'] + $objattr[
'border_bottom'][
'w'] + $objattr[
'margin_top'] + $objattr[
'margin_bottom']) / $k;
9113 if ($type ==
'image' || $type ==
'barcode' || $type ==
'textcircle') {
9114 $extraWidth += ($objattr[
'padding_left'] + $objattr[
'padding_right']) / $k;
9115 $extraHeight += ($objattr[
'padding_top'] + $objattr[
'padding_bottom']) / $k;
9119 if (!isset($objattr[
'vertical-align'])) {
9120 if ($objattr[
'type'] ==
'select') {
9121 $objattr[
'vertical-align'] =
'M';
9123 $objattr[
'vertical-align'] =
'BS';
9127 if ($type ==
'image' || (isset($objattr[
'subtype']) && $objattr[
'subtype'] ==
'IMAGE')) {
9128 if (isset($objattr[
'itype']) && ($objattr[
'itype'] ==
'wmf' || $objattr[
'itype'] ==
'svg')) {
9129 $file = $objattr[
'file'];
9130 $info = $this->formobjects[$file];
9131 } elseif (isset($objattr[
'file'])) {
9132 $file = $objattr[
'file'];
9133 $info = $this->images[$file];
9136 if ($type ==
'annot' || $type ==
'bookmark' || $type ==
'indexentry' || $type ==
'toc') {
9143 if ($type ==
'hr') {
9144 if (($y + $h + $lineHeight > $this->PageBreakTrigger) && !$this->InFooter && !$is_table) {
9145 return [-2, $w, $h];
9152 $displayheight = $h;
9154 if ($objattr[
'type'] ==
'image' && isset($objattr[
'listmarker']) && $objattr[
'listmarker']) {
9156 if ($objattr[
'listmarkerposition'] ==
'outside') {
9161 if ($widthUsed > 0 && $displaywidth > $widthLeft && (!$is_table || $type !=
'image')) {
9163 if (($y + $displayheight + $lineHeight > $this->PageBreakTrigger) && !$this->InFooter) {
9164 return [-2, $w, $h];
9167 } elseif ($widthUsed > 0 && $displaywidth > $widthLeft && $is_table) {
9170 elseif (($y + $displayheight > $this->PageBreakTrigger) && !$this->InFooter && !$is_table) {
9171 return [-1, $w, $h];
9179 if ($type ==
'annot' || $type ==
'bookmark' || $type ==
'indexentry' || $type ==
'toc') {
9182 $objattr[
'BORDER-WIDTH'] = 0;
9183 $objattr[
'BORDER-HEIGHT'] = 0;
9184 $objattr[
'BORDER-X'] = $x;
9185 $objattr[
'BORDER-Y'] = $y;
9186 $objattr[
'INNER-WIDTH'] = 0;
9187 $objattr[
'INNER-HEIGHT'] = 0;
9188 $objattr[
'INNER-X'] = $x;
9189 $objattr[
'INNER-Y'] = $y;
9192 if ($type ==
'image') {
9194 if ($w > ($widthLeft + 0.0001) && !$is_table) {
9196 $h = abs($w * $info[
'h'] / $info[
'w']);
9198 $img_w = $w - $extraWidth;
9199 $img_h = $h - $extraHeight;
9201 $objattr[
'BORDER-WIDTH'] = $img_w + $objattr[
'padding_left'] / $k + $objattr[
'padding_right'] / $k + (($objattr[
'border_left'][
'w'] / $k + $objattr[
'border_right'][
'w'] / $k) / 2);
9202 $objattr[
'BORDER-HEIGHT'] = $img_h + $objattr[
'padding_top'] / $k + $objattr[
'padding_bottom'] / $k + (($objattr[
'border_top'][
'w'] / $k + $objattr[
'border_bottom'][
'w'] / $k) / 2);
9203 $objattr[
'BORDER-X'] = $x + $objattr[
'margin_left'] / $k + (($objattr[
'border_left'][
'w'] / $k) / 2);
9204 $objattr[
'BORDER-Y'] = $y + $objattr[
'margin_top'] / $k + (($objattr[
'border_top'][
'w'] / $k) / 2);
9205 $objattr[
'INNER-WIDTH'] = $img_w;
9206 $objattr[
'INNER-HEIGHT'] = $img_h;
9207 $objattr[
'INNER-X'] = $x + $objattr[
'padding_left'] / $k + $objattr[
'margin_left'] / $k + ($objattr[
'border_left'][
'w'] / $k);
9208 $objattr[
'INNER-Y'] = $y + $objattr[
'padding_top'] / $k + $objattr[
'margin_top'] / $k + ($objattr[
'border_top'][
'w'] / $k);
9209 $objattr[
'ID'] = $info[
'i'];
9212 if ($type ==
'input' && $objattr[
'subtype'] ==
'IMAGE') {
9213 $img_w = $w - $extraWidth;
9214 $img_h = $h - $extraHeight;
9215 $objattr[
'BORDER-WIDTH'] = $img_w + (($objattr[
'border_left'][
'w'] / $k + $objattr[
'border_right'][
'w'] / $k) / 2);
9216 $objattr[
'BORDER-HEIGHT'] = $img_h + (($objattr[
'border_top'][
'w'] / $k + $objattr[
'border_bottom'][
'w'] / $k) / 2);
9217 $objattr[
'BORDER-X'] = $x + $objattr[
'margin_left'] / $k + (($objattr[
'border_left'][
'w'] / $k) / 2);
9218 $objattr[
'BORDER-Y'] = $y + $objattr[
'margin_top'] / $k + (($objattr[
'border_top'][
'w'] / $k) / 2);
9219 $objattr[
'INNER-WIDTH'] = $img_w;
9220 $objattr[
'INNER-HEIGHT'] = $img_h;
9221 $objattr[
'INNER-X'] = $x + $objattr[
'margin_left'] / $k + ($objattr[
'border_left'][
'w'] / $k);
9222 $objattr[
'INNER-Y'] = $y + $objattr[
'margin_top'] / $k + ($objattr[
'border_top'][
'w'] / $k);
9223 $objattr[
'ID'] = $info[
'i'];
9226 if ($type ==
'barcode' || $type ==
'textcircle') {
9227 $b_w = $w - $extraWidth;
9228 $b_h = $h - $extraHeight;
9229 $objattr[
'BORDER-WIDTH'] = $b_w + $objattr[
'padding_left'] / $k + $objattr[
'padding_right'] / $k + (($objattr[
'border_left'][
'w'] / $k + $objattr[
'border_right'][
'w'] / $k) / 2);
9230 $objattr[
'BORDER-HEIGHT'] = $b_h + $objattr[
'padding_top'] / $k + $objattr[
'padding_bottom'] / $k + (($objattr[
'border_top'][
'w'] / $k + $objattr[
'border_bottom'][
'w'] / $k) / 2);
9231 $objattr[
'BORDER-X'] = $x + $objattr[
'margin_left'] / $k + (($objattr[
'border_left'][
'w'] / $k) / 2);
9232 $objattr[
'BORDER-Y'] = $y + $objattr[
'margin_top'] / $k + (($objattr[
'border_top'][
'w'] / $k) / 2);
9233 $objattr[
'INNER-X'] = $x + $objattr[
'padding_left'] / $k + $objattr[
'margin_left'] / $k + ($objattr[
'border_left'][
'w'] / $k);
9234 $objattr[
'INNER-Y'] = $y + $objattr[
'padding_top'] / $k + $objattr[
'margin_top'] / $k + ($objattr[
'border_top'][
'w'] / $k);
9235 $objattr[
'INNER-WIDTH'] = $b_w;
9236 $objattr[
'INNER-HEIGHT'] = $b_h;
9240 if ($type ==
'textarea') {
9242 if ($w > $widthLeft && !$is_table) {
9251 if ($type ==
'hr') {
9253 $objattr[
'INNER-WIDTH'] = $maxWidth * $objattr[
'W-PERCENT'] / 100;
9254 $objattr[
'width'] = $objattr[
'INNER-WIDTH'];
9257 if ($w > $maxWidth) {
9260 $objattr[
'INNER-WIDTH'] = $w;
9267 if (($type ==
'select') || ($type ==
'input' && ($objattr[
'subtype'] ==
'TEXT' || $objattr[
'subtype'] ==
'PASSWORD'))) {
9269 if ($w > $widthLeft && !$is_table) {
9274 if ($type ==
'textarea' || $type ==
'select' || $type ==
'input') {
9275 if (isset($objattr[
'fontsize'])) {
9276 $objattr[
'fontsize'] /= $k;
9278 if (isset($objattr[
'linewidth'])) {
9279 $objattr[
'linewidth'] /= $k;
9283 if (!isset($objattr[
'BORDER-Y'])) {
9284 $objattr[
'BORDER-Y'] = 0;
9286 if (!isset($objattr[
'BORDER-X'])) {
9287 $objattr[
'BORDER-X'] = 0;
9289 if (!isset($objattr[
'INNER-Y'])) {
9290 $objattr[
'INNER-Y'] = 0;
9292 if (!isset($objattr[
'INNER-X'])) {
9293 $objattr[
'INNER-X'] = 0;
9297 $objattr[
'OUTER-WIDTH'] = $w;
9298 $objattr[
'OUTER-HEIGHT'] = $h;
9299 $objattr[
'OUTER-X'] = $x;
9300 $objattr[
'OUTER-Y'] = $y;
9314 $s = sprintf(
'%d j', $mode);
9315 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'LineJoin']) && $this->pageoutput[$this->page][
'LineJoin'] != $s) || !isset($this->pageoutput[$this->page][
'LineJoin']))) {
9316 $this->writer->write($s);
9318 $this->pageoutput[$this->page][
'LineJoin'] = $s;
9323 $s = sprintf(
'%d J', $mode);
9324 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'LineCap']) && $this->pageoutput[$this->page][
'LineCap'] != $s) || !isset($this->pageoutput[$this->page][
'LineCap']))) {
9325 $this->writer->write($s);
9327 $this->pageoutput[$this->page][
'LineCap'] = $s;
9332 if ($black and $white) {
9333 $s = sprintf(
'[%.3F %.3F] 0 d', $black * Mpdf::SCALE, $white * Mpdf::SCALE);
9338 if ($this->page > 0 && ((isset($this->pageoutput[$this->page][
'Dash']) && $this->pageoutput[$this->page][
'Dash'] != $s) || !isset($this->pageoutput[$this->page][
'Dash']))) {
9339 $this->writer->write($s);
9342 $this->pageoutput[$this->page][
'Dash'] = $s;
9349 $this->DisplayPreferences .= $preferences;
9352 function Ln($h =
'', $collapsible = 0)
9357 $margin = isset($this->blk[$this->blklvl][
'outer_left_margin']) ? $this->blk[$this->blklvl][
'outer_left_margin'] : 0;
9359 $this->x = $this->lMargin + $margin;
9361 if ($collapsible && ($this->y == $this->tMargin) && (!$this->ColActive)) {
9365 if (is_string($h)) {
9366 $this->y += $this->lasth;
9374 function DivLn($h, $level = -3, $move_y =
true, $collapsible =
false, $state = 0)
9383 if ($collapsible && (sprintf(
"%0.4f", $this->y) == sprintf(
"%0.4f", $this->tMargin)) && (!$this->ColActive)) {
9389 if ($collapsible && (sprintf(
"%0.4f", $this->y) == sprintf(
"%0.4f", $this->y0)) && ($this->ColActive)) {
9394 if (!$this->ColActive && !$this->kwt) {
9395 if ($move_y && !$this->ColActive) {
9402 $level = $this->blklvl;
9404 $firstblockfill = $this->GetFirstBlockFill();
9405 if ($firstblockfill && $this->blklvl > 0 && $this->blklvl >= $firstblockfill) {
9408 $last_fc = $this->FillColor;
9410 $bak_h = $this->divheight;
9411 $this->divheight = 0;
9412 for ($blvl = $firstblockfill; $blvl <= $level; $blvl++) {
9413 $this->x = $this->lMargin + $this->blk[$blvl][
'outer_left_margin'];
9415 if ($this->blk[$blvl][
'bgcolor']) {
9416 $this->SetFColor($this->blk[$blvl][
'bgcolorarray']);
9418 if ($last_x != ($this->lMargin + $this->blk[$blvl][
'outer_left_margin']) || ($last_w != $this->blk[$blvl][
'width']) || $last_fc != $this->FillColor || (isset($this->blk[$blvl][
'border_top'][
's']) && $this->blk[$blvl][
'border_top'][
's']) || (isset($this->blk[$blvl][
'border_bottom'][
's']) && $this->blk[$blvl][
'border_bottom'][
's']) || (isset($this->blk[$blvl][
'border_left'][
's']) && $this->blk[$blvl][
'border_left'][
's']) || (isset($this->blk[$blvl][
'border_right'][
's']) && $this->blk[$blvl][
'border_right'][
's'])) {
9420 $this->Cell(($this->blk[$blvl][
'width']), $h,
'',
'', 0,
'', 1);
9422 if (!$this->keep_block_together && !$this->writingHTMLheader && !$this->writingHTMLfooter) {
9424 if ($blvl == $this->blklvl) {
9425 $this->PaintDivLnBorder($state, $blvl, $h);
9427 $this->PaintDivLnBorder(0, $blvl, $h);
9431 $last_x = $this->lMargin + $this->blk[$blvl][
'outer_left_margin'];
9432 $last_w = $this->blk[$blvl][
'width'];
9433 $last_fc = $this->FillColor;
9436 if (isset($this->blk[$this->blklvl][
'bgcolorarray'])) {
9437 $bcor = $this->blk[$this->blklvl][
'bgcolorarray'];
9438 $this->SetFColor($bcor);
9441 $this->divheight = $bak_h;
9456 $this->x = $this->w + $x;
9463 $this->x = $this->lMargin;
9467 $this->y = $this->h + $y;
9480 $this->logger->debug(sprintf(
'PDF generated in %.6F seconds', microtime(
true) - $this->time0), [
'context' => LogContext::STATISTICS]);
9483 if ($this->state < 3) {
9487 if ($this->debug && error_get_last()) {
9488 $e = error_get_last();
9489 if (($e[
'type'] < 2048 && $e[
'type'] != 8) || (intval($e[
'type']) & intval(ini_get(
"error_reporting")))) {
9490 throw new \Mpdf\MpdfException(
9491 sprintf(
'Error detected. PDF file generation aborted: %s', $e[
'message']),
9500 if (($this->PDFA || $this->PDFX) && $this->encrypted) {
9501 throw new \Mpdf\MpdfException(
'PDF/A1-b or PDF/X1-a does not permit encryption of documents.');
9504 if (count($this->PDFAXwarnings) && (($this->PDFA && !$this->PDFAauto) || ($this->PDFX && !$this->PDFXauto))) {
9506 $standard =
'PDFA/1-b';
9507 $option =
'$mpdf->PDFAauto';
9509 $standard =
'PDFX/1-a ';
9510 $option =
'$mpdf->PDFXauto';
9513 $this->logger->warning(sprintf(
'PDF could not be generated as it stands as a %s compliant file.', $standard), [
'context' => LogContext::PDFA_PDFX]);
9514 $this->logger->warning(sprintf(
'These issues can be automatically fixed by mPDF using %s = true;', $option), [
'context' => LogContext::PDFA_PDFX]);
9515 $this->logger->warning(sprintf(
'Action that mPDF will take to automatically force %s compliance are shown further in the log.', $standard), [
'context' => LogContext::PDFA_PDFX]);
9517 $this->PDFAXwarnings = array_unique($this->PDFAXwarnings);
9518 foreach ($this->PDFAXwarnings as $w) {
9519 $this->logger->warning($w, [
'context' => LogContext::PDFA_PDFX]);
9522 throw new \Mpdf\MpdfException(
'PDFA/PDFX warnings generated. See log for further details');
9525 $this->logger->debug(sprintf(
'Compiled in %.6F seconds', microtime(
true) - $this->time0), [
'context' => LogContext::STATISTICS]);
9526 $this->logger->debug(sprintf(
'Peak Memory usage %s MB', number_format(memory_get_peak_usage(
true) / (1024 * 1024), 2)), [
'context' => LogContext::STATISTICS]);
9527 $this->logger->debug(sprintf(
'PDF file size %s kB', number_format(strlen($this->buffer) / 1024)), [
'context' => LogContext::STATISTICS]);
9528 $this->logger->debug(sprintf(
'%d fonts used', count($this->fonts)), [
'context' => LogContext::STATISTICS]);
9530 if (is_bool(
$dest)) {
9548 if (headers_sent($filename, $line)) {
9549 throw new \Mpdf\MpdfException(
9550 sprintf(
'Data has already been sent to output (%s at line %s), unable to output PDF file', $filename, $line)
9554 if ($this->debug && !$this->allow_output_buffering && ob_get_contents()) {
9555 throw new \Mpdf\MpdfException(
'Output has already been sent from the script - PDF file generation aborted.');
9559 if (PHP_SAPI !==
'cli') {
9560 header(
'Content-Type: application/pdf');
9562 if (!isset($_SERVER[
'HTTP_ACCEPT_ENCODING']) || empty($_SERVER[
'HTTP_ACCEPT_ENCODING'])) {
9564 header(
'Content-Length: ' . strlen($this->buffer));
9567 header(
'Content-disposition: inline; filename="' .
$name .
'"');
9568 header(
'Cache-Control: public, must-revalidate, max-age=0');
9569 header(
'Pragma: public');
9570 header(
'X-Generator: mPDF' . ($this->exposeVersion ? (
' ' . static::VERSION) :
''));
9571 header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT');
9572 header(
'Last-Modified: ' . gmdate(
'D, d M Y H:i:s') .
' GMT');
9581 if (headers_sent()) {
9582 throw new \Mpdf\MpdfException(
'Data has already been sent to output, unable to output PDF file');
9585 header(
'Content-Description: File Transfer');
9586 header(
'Content-Transfer-Encoding: binary');
9587 header(
'Cache-Control: public, must-revalidate, max-age=0');
9588 header(
'Pragma: public');
9589 header(
'X-Generator: mPDF' . ($this->exposeVersion ? (
' ' . static::VERSION) :
''));
9590 header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT');
9591 header(
'Last-Modified: ' . gmdate(
'D, d M Y H:i:s') .
' GMT');
9592 header(
'Content-Type: application/pdf');
9594 if (!isset($_SERVER[
'HTTP_ACCEPT_ENCODING']) || empty($_SERVER[
'HTTP_ACCEPT_ENCODING'])) {
9596 header(
'Content-Length: ' . strlen($this->buffer));
9599 header(
'Content-Disposition: attachment; filename="' .
$name .
'"');
9606 $f = fopen(
$name,
'wb');
9609 throw new \Mpdf\MpdfException(sprintf(
'Unable to create output file %s',
$name));
9612 fwrite($f, $this->buffer, strlen($this->buffer));
9618 $this->cache->clearOld();
9619 return $this->buffer;
9622 throw new \Mpdf\MpdfException(sprintf(
'Incorrect output destination %s',
$dest));
9625 $this->cache->clearOld();
9637 throw new \Mpdf\MpdfException(
'Do not alter the locale before including mPDF');
9641 if (sprintf(
'%.1f', 1.0) !=
'1.0') {
9642 setlocale(LC_NUMERIC,
'C');
9645 if (ini_get(
'mbstring.func_overload')) {
9646 throw new \Mpdf\MpdfException(
'Mpdf cannot function properly with mbstring.func_overload enabled');
9649 if (!function_exists(
'mb_substr')) {
9650 throw new \Mpdf\MpdfException(
'mbstring extension must be loaded in order to run mPDF');
9653 if (!function_exists(
'mb_regex_encoding')) {
9654 if (strtoupper(substr(PHP_OS, 0, 3)) ===
'WIN') {
9655 $mamp =
' If using MAMP, there is a bug in its PHP build causing this.';
9658 throw new \Mpdf\MpdfException(
'mbstring extension with mbregex support must be loaded in order to run mPDF.' . $mamp);
9666 for ($n = 1; $n <= $nb; $n++) {
9667 if ($this->mirrorMargins && $n % 2 == 0) {
9674 $pn = $this->docPageNum($n);
9676 $pnstr = $this->pagenumPrefix . $pn . $this->pagenumSuffix;
9681 $pnt = $this->docPageNumTotal($n);
9684 $pntstr = $this->nbpgPrefix . $pnt . $this->nbpgSuffix;
9689 if (isset($this->saveHTMLHeader[$n][$OE])) {
9690 $html = isset($this->saveHTMLHeader[$n][$OE][
'html']) ? $this->saveHTMLHeader[$n][$OE][
'html'] :
'';
9691 $this->lMargin = $this->saveHTMLHeader[$n][$OE][
'ml'];
9692 $this->rMargin = $this->saveHTMLHeader[$n][$OE][
'mr'];
9693 $this->tMargin = $this->saveHTMLHeader[$n][$OE][
'mh'];
9694 $this->bMargin = $this->saveHTMLHeader[$n][$OE][
'mf'];
9695 $this->margin_header = $this->saveHTMLHeader[$n][$OE][
'mh'];
9696 $this->margin_footer = $this->saveHTMLHeader[$n][$OE][
'mf'];
9697 $this->w = $this->saveHTMLHeader[$n][$OE][
'pw'];
9698 $this->h = $this->saveHTMLHeader[$n][$OE][
'ph'];
9699 $rotate = (isset($this->saveHTMLHeader[$n][$OE][
'rotate']) ? $this->saveHTMLHeader[$n][$OE][
'rotate'] :
null);
9701 $this->pageoutput[$n] = [];
9702 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
9703 $this->x = $this->lMargin;
9704 $this->y = $this->margin_header;
9707 $html = $this->aliasReplace(
$html, $pnstr, $pntstr, $nb);
9709 $this->HTMLheaderPageLinks = [];
9710 $this->HTMLheaderPageAnnots = [];
9711 $this->HTMLheaderPageForms = [];
9712 $this->pageBackgrounds = [];
9714 $this->writingHTMLheader =
true;
9716 $this->writingHTMLheader =
false;
9718 $this->pageoutput[$n] = [];
9720 $s = $this->PrintPageBackgrounds();
9721 $this->headerbuffer = $s . $this->headerbuffer;
9724 $os .= sprintf(
'q 0 -1 1 0 0 %.3F cm ', ($this->w * Mpdf::SCALE));
9728 $os .= $this->headerbuffer;
9734 $os = preg_replace([
'/\\\\/',
'/\$/'], [
'\\\\\\\\',
'\\\\$'], $os);
9736 $this->pages[$n] = preg_replace(
'/(___HEADER___MARKER' . $this->uniqstr .
')/',
"\n" . $os .
"\n" .
'\\1', $this->pages[$n]);
9738 $lks = $this->HTMLheaderPageLinks;
9739 foreach ($lks as $lk) {
9745 $ax = $lk[0] / Mpdf::SCALE;
9746 $ay = $lk[1] / Mpdf::SCALE;
9747 $bx = $ay - ($lh / Mpdf::SCALE);
9748 $by = $this->w - $ax;
9749 $lk[0] = $bx * Mpdf::SCALE;
9750 $lk[1] = ($this->h - $by) * Mpdf::SCALE - $lw;
9752 $this->PageLinks[$n][] = $lk;
9755 foreach ($this->HTMLheaderPageForms as $f) {
9756 $this->form->forms[$f[
'n']] = $f;
9761 if (isset($this->saveHTMLFooter[$n][$OE])) {
9763 $html = $this->saveHTMLFooter[$this->page][$OE][
'html'];
9765 $this->lMargin = $this->saveHTMLFooter[$n][$OE][
'ml'];
9766 $this->rMargin = $this->saveHTMLFooter[$n][$OE][
'mr'];
9767 $this->tMargin = $this->saveHTMLFooter[$n][$OE][
'mh'];
9768 $this->bMargin = $this->saveHTMLFooter[$n][$OE][
'mf'];
9769 $this->margin_header = $this->saveHTMLFooter[$n][$OE][
'mh'];
9770 $this->margin_footer = $this->saveHTMLFooter[$n][$OE][
'mf'];
9771 $this->w = $this->saveHTMLFooter[$n][$OE][
'pw'];
9772 $this->h = $this->saveHTMLFooter[$n][$OE][
'ph'];
9773 $rotate = (isset($this->saveHTMLFooter[$n][$OE][
'rotate']) ? $this->saveHTMLFooter[$n][$OE][
'rotate'] :
null);
9775 $this->pageoutput[$n] = [];
9776 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
9777 $this->x = $this->lMargin;
9778 $top_y = $this->y = $this->h - $this->margin_footer;
9781 if ($this->y == $this->h) {
9782 $top_y = $this->y = ($this->h + 0.01);
9786 $html = $this->aliasReplace(
$html, $pnstr, $pntstr, $nb);
9788 $this->HTMLheaderPageLinks = [];
9789 $this->HTMLheaderPageAnnots = [];
9790 $this->HTMLheaderPageForms = [];
9791 $this->pageBackgrounds = [];
9793 $this->writingHTMLfooter =
true;
9794 $this->InFooter =
true;
9796 $this->InFooter =
false;
9798 $this->pageoutput[$n] = [];
9800 $fheight = $this->y - $top_y;
9803 $s = $this->PrintPageBackgrounds(-$adj);
9804 $this->headerbuffer = $s . $this->headerbuffer;
9805 $this->writingHTMLfooter =
false;
9808 $os .= $this->StartTransform(
true) .
"\n";
9811 $os .= sprintf(
'q 0 -1 1 0 0 %.3F cm ', ($this->w * Mpdf::SCALE));
9816 $os .= $this->transformTranslate(0, $adj,
true) .
"\n";
9817 $os .= $this->headerbuffer;
9823 $os .= $this->StopTransform(
true) .
"\n";
9826 $os = preg_replace([
'/\\\\/',
'/\$/'], [
'\\\\\\\\',
'\\\\$'], $os);
9828 $this->pages[$n] = preg_replace(
'/(___HEADER___MARKER' . $this->uniqstr .
')/',
"\n" . $os .
"\n" .
'\\1', $this->pages[$n]);
9830 $lks = $this->HTMLheaderPageLinks;
9832 foreach ($lks as $lk) {
9834 $lk[1] -= $adj * Mpdf::SCALE;
9842 $ax = $lk[0] / Mpdf::SCALE;
9843 $ay = $lk[1] / Mpdf::SCALE;
9844 $bx = $ay - ($lh / Mpdf::SCALE);
9845 $by = $this->w - $ax;
9846 $lk[0] = $bx * Mpdf::SCALE;
9847 $lk[1] = ($this->h - $by) * Mpdf::SCALE - $lw;
9850 $this->PageLinks[$n][] = $lk;
9854 foreach ($this->HTMLheaderPageForms as $f) {
9856 $this->form->forms[$f[
'n']] = $f;
9863 $this->pages[$n] = $this->aliasReplace($this->pages[$n], $pnstr, $pntstr, $nb);
9871 function Annotation($text, $x = 0, $y = 0, $icon =
'Note', $author =
'', $subject =
'', $opacity = 0, $colarray =
false, $popup =
'', $file =
'')
9873 if (is_array($colarray) && count($colarray) == 3) {
9874 $colarray = $this->colorConverter->convert(
'rgb(' . $colarray[0] .
',' . $colarray[1] .
',' . $colarray[2] .
')', $this->PDFAXwarnings);
9876 if ($colarray ===
false) {
9877 $colarray = $this->colorConverter->convert(
'yellow', $this->PDFAXwarnings);
9885 $page = $this->page;
9889 $x = $this->lMargin;
9892 $y = $this->tMargin;
9896 if ($this->PDFA || $this->PDFX) {
9897 if (($this->PDFA && !$this->PDFAauto) || ($this->PDFX && !$this->PDFXauto)) {
9898 $this->PDFAXwarnings[] =
"Annotation markers cannot be semi-transparent in PDFA1-b or PDFX/1-a, so they may make underlying text unreadable. (Annotation markers moved to right margin)";
9900 $x = ($this->w) - $this->rMargin * 0.66;
9902 if (!$this->annotMargin) {
9903 $y -= $this->FontSize / 2;
9906 if (!$opacity && $this->annotMargin) {
9908 } elseif (!$opacity) {
9909 $opacity = $this->annotOpacity;
9912 $an = [
'txt' => $text,
'x' => $x,
'y' => $y,
'opt' => [
'Icon' => $icon,
'T' => $author,
'Subj' => $subject,
'C' => $colarray,
'CA' => $opacity,
'popup' => $popup,
'file' => $file]];
9914 if ($this->keep_block_together) {
9916 } elseif ($this->table_rotate) {
9917 $this->tbrot_Annots[$this->page][] = $an;
9919 } elseif ($this->kwt) {
9920 $this->kwt_Annots[$this->page][] = $an;
9924 if ($this->writingHTMLheader || $this->writingHTMLfooter) {
9925 $this->HTMLheaderPageAnnots[] = $an;
9930 $this->PageAnnots[$page][] = $an;
9934 $ref = isset($this->PageAnnots[$this->page]) ? (count($this->PageAnnots[$this->page]) - 1) : -1;
9935 $this->columnAnnots[$this->CurrCol][intval($this->x)][intval($this->y)] = $ref;
9945 $this->_puthtmlheaders();
9950 foreach ($this->fonts as $fk => $font) {
9951 if (isset($font[
'type']) && $font[
'type'] ==
'TTF' && !$font[
'used']) {
9952 if ($font[
'sip'] || $font[
'smp']) {
9953 foreach ($font[
'subsetfontids'] as $k => $fid) {
9954 foreach ($this->pages as $pn => $page) {
9955 $this->pages[$pn] = preg_replace(
'/\s\/F' . $fid .
' \d[\d.]* Tf\s/is',
' ', $this->pages[$pn]);
9959 foreach ($this->pages as $pn => $page) {
9960 $this->pages[$pn] = preg_replace(
'/\s\/F' . $font[
'i'] .
' \d[\d.]* Tf\s/is',
' ', $this->pages[$pn]);
9966 if (count($this->layers)) {
9967 foreach ($this->pages as $pn => $page) {
9968 preg_match_all(
'/\/OCZ-index \/ZI(\d+) BDC(.*?)(EMCZ)-index/is', $this->pages[$pn], $m1);
9969 preg_match_all(
'/\/OCBZ-index \/ZI(\d+) BDC(.*?)(EMCBZ)-index/is', $this->pages[$pn], $m2);
9970 preg_match_all(
'/\/OCGZ-index \/ZI(\d+) BDC(.*?)(EMCGZ)-index/is', $this->pages[$pn], $m3);
9972 for ($i = 0; $i < 4; $i++) {
9973 $m[$i] = array_merge($m1[$i], $m2[$i], $m3[$i]);
9977 for ($i = 0; $i < count($m[0]); $i++) {
9978 $key = $m[1][$i] * 2;
9979 if ($m[3][$i] ==
'EMCZ') {
9981 } elseif ($m[3][$i] ==
'EMCGZ') {
9984 $sortarr[$i] = $key;
9987 foreach ($sortarr as $i => $k) {
9988 $this->pages[$pn] = str_replace($m[0][$i],
'', $this->pages[$pn]);
9989 $this->pages[$pn] .=
"\n" . $m[0][$i] .
"\n";
9991 $this->pages[$pn] = preg_replace(
'/\/OC[BG]{0,1}Z-index \/ZI(\d+) BDC/is',
'/OC /ZI\\1 BDC ', $this->pages[$pn]);
9992 $this->pages[$pn] = preg_replace(
'/EMC[BG]{0,1}Z-index/is',
'EMC', $this->pages[$pn]);
9997 $this->pageWriter->writePages();
10001 $this->resourceWriter->writeResources();
10004 $this->writer->object();
10005 $this->InfoRoot = $this->n;
10006 $this->writer->write(
'<<');
10009 $this->metadataWriter->writeInfo();
10011 $this->writer->write(
'>>');
10012 $this->writer->write(
'endobj');
10015 if ($this->PDFA || $this->PDFX) {
10016 $this->metadataWriter->writeMetadata();
10020 if ($this->PDFA || $this->PDFX || $this->ICCProfile) {
10021 $this->metadataWriter->writeOutputIntent();
10025 if ($this->associatedFiles) {
10026 $this->metadataWriter->writeAssociatedFiles();
10030 $this->writer->object();
10031 $this->writer->write(
'<<');
10035 $this->metadataWriter->writeCatalog();
10037 $this->writer->write(
'>>');
10038 $this->writer->write(
'endobj');
10041 $o = strlen($this->buffer);
10042 $this->writer->write(
'xref');
10043 $this->writer->write(
'0 ' . ($this->n + 1));
10044 $this->writer->write(
'0000000000 65535 f ');
10046 for ($i = 1; $i <= $this->n; $i++) {
10047 $this->writer->write(sprintf(
'%010d 00000 n ', $this->offsets[$i]));
10051 $this->writer->write(
'trailer');
10052 $this->writer->write(
'<<');
10054 $this->metadataWriter->writeTrailer();
10056 $this->writer->write(
'>>');
10057 $this->writer->write(
'startxref');
10058 $this->writer->write($o);
10060 $this->buffer .=
'%%EOF';
10083 if (!($pagesel && $this->page == 1 && (sprintf(
"%0.4f", $this->y) == sprintf(
"%0.4f", $this->tMargin)))) {
10085 $this->pages[$this->page] =
'';
10088 $resetHTMLHeadersrequired =
false;
10091 $this->_setPageSize($newformat, $orientation);
10096 if ($pagesel || (isset($this->page_box[
'using']) && $this->page_box[
'using'])) {
10098 if ($pagesel || $this->page == 1) {
10104 if ($this->mirrorMargins && ($this->page % 2 == 0)) {
10112 } elseif ($this->page_box[
'current']) {
10113 $psel = $this->page_box[
'current'];
10118 list($orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $hname, $fname, $bg, $resetpagenum, $pagenumstyle, $suppress, $marks, $newformat) = $this->SetPagedMediaCSS($psel, $first, $oddEven);
10120 if ($this->mirrorMargins && ($this->page % 2 == 0)) {
10153 if ($resetpagenum || $pagenumstyle || $suppress) {
10154 $this->PageNumSubstitutions[] = [
'from' => ($this->page),
'reset' => $resetpagenum,
'type' => $pagenumstyle,
'suppress' => $suppress];
10158 $this->show_marks = $marks;
10161 if (isset($bg[
'BACKGROUND-COLOR'])) {
10162 $cor = $this->colorConverter->convert($bg[
'BACKGROUND-COLOR'], $this->PDFAXwarnings);
10164 $this->bodyBackgroundColor = $cor;
10167 $this->bodyBackgroundColor =
false;
10171 if (isset($bg[
'BACKGROUND-GRADIENT'])) {
10172 $this->bodyBackgroundGradient = $bg[
'BACKGROUND-GRADIENT'];
10174 $this->bodyBackgroundGradient =
false;
10178 if (isset($bg[
'BACKGROUND-IMAGE']) && $bg[
'BACKGROUND-IMAGE']) {
10179 $ret = $this->SetBackground($bg, $this->pgwidth);
10181 $this->bodyBackgroundImage = $ret;
10184 $this->bodyBackgroundImage =
false;
10188 $this->page_box[
'current'] = $psel;
10189 $this->page_box[
'using'] =
true;
10194 if (!$orientation) {
10195 $orientation = $this->DefOrientation;
10197 $orientation = strtoupper(substr($orientation, 0, 1));
10198 if ($orientation != $this->DefOrientation) {
10199 $this->OrientationChanges[$this->page] =
true;
10203 if ($orientation != $this->CurOrientation || $newformat) {
10206 if ($orientation ==
'P') {
10207 $this->wPt = $this->fwPt;
10208 $this->hPt = $this->fhPt;
10209 $this->w = $this->fw;
10210 $this->h = $this->fh;
10211 if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation ==
'P') {
10212 $this->tMargin = $this->orig_tMargin;
10213 $this->bMargin = $this->orig_bMargin;
10214 $this->DeflMargin = $this->orig_lMargin;
10215 $this->DefrMargin = $this->orig_rMargin;
10216 $this->margin_header = $this->orig_hMargin;
10217 $this->margin_footer = $this->orig_fMargin;
10219 $resetHTMLHeadersrequired =
true;
10222 $this->wPt = $this->fhPt;
10223 $this->hPt = $this->fwPt;
10224 $this->w = $this->fh;
10225 $this->h = $this->fw;
10227 if (($this->forcePortraitHeaders || $this->forcePortraitMargins) && $this->DefOrientation ==
'P') {
10228 $this->tMargin = $this->orig_lMargin;
10229 $this->bMargin = $this->orig_rMargin;
10230 $this->DeflMargin = $this->orig_bMargin;
10231 $this->DefrMargin = $this->orig_tMargin;
10232 $this->margin_header = $this->orig_hMargin;
10233 $this->margin_footer = $this->orig_fMargin;
10235 $resetHTMLHeadersrequired =
true;
10239 $this->CurOrientation = $orientation;
10240 $this->ResetMargins();
10241 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
10242 $this->PageBreakTrigger = $this->h - $this->bMargin;
10245 $this->pageDim[$this->page][
'w'] = $this->w;
10246 $this->pageDim[$this->page][
'h'] = $this->h;
10248 $this->pageDim[$this->page][
'outer_width_LR'] = isset($this->page_box[
'outer_width_LR']) ? $this->page_box[
'outer_width_LR'] : 0;
10249 $this->pageDim[$this->page][
'outer_width_TB'] = isset($this->page_box[
'outer_width_TB']) ? $this->page_box[
'outer_width_TB'] : 0;
10251 if (!isset($this->page_box[
'outer_width_LR']) && !isset($this->page_box[
'outer_width_TB'])) {
10252 $this->pageDim[$this->page][
'bleedMargin'] = 0;
10253 } elseif ($this->bleedMargin <= $this->page_box[
'outer_width_LR'] && $this->bleedMargin <= $this->page_box[
'outer_width_TB']) {
10254 $this->pageDim[$this->page][
'bleedMargin'] = $this->bleedMargin;
10256 $this->pageDim[$this->page][
'bleedMargin'] = min($this->page_box[
'outer_width_LR'], $this->page_box[
'outer_width_TB']) - 0.01;
10261 if ((strlen($mgl) > 0 && $this->DeflMargin != $mgl) || (strlen($mgr) > 0 && $this->DefrMargin != $mgr) || (strlen($mgt) > 0 && $this->tMargin != $mgt) || (strlen($mgb) > 0 && $this->bMargin != $mgb) || (strlen($mgh) > 0 && $this->margin_header != $mgh) || (strlen($mgf) > 0 && $this->margin_footer != $mgf)) {
10263 if (strlen($mgl) > 0) {
10264 $this->DeflMargin = $mgl;
10267 if (strlen($mgr) > 0) {
10268 $this->DefrMargin = $mgr;
10271 if (strlen($mgt) > 0) {
10272 $this->tMargin = $mgt;
10275 if (strlen($mgb) > 0) {
10276 $this->bMargin = $mgb;
10279 if (strlen($mgh) > 0) {
10280 $this->margin_header = $mgh;
10283 if (strlen($mgf) > 0) {
10284 $this->margin_footer = $mgf;
10287 $this->ResetMargins();
10288 $this->SetAutoPageBreak($this->autoPageBreak, $this->bMargin);
10290 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
10291 $resetHTMLHeadersrequired =
true;
10294 $this->ResetMargins();
10295 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
10296 $this->SetAutoPageBreak($this->autoPageBreak, $this->bMargin);
10299 $this->y0 = $this->tMargin;
10301 $this->x = $this->lMargin;
10302 $this->y = $this->tMargin;
10303 $this->FontFamily =
'';
10306 if ($ohvalue < 0 || strtoupper($ohvalue) ==
'OFF') {
10307 $this->HTMLHeader =
'';
10308 $resetHTMLHeadersrequired =
true;
10309 } elseif ($ohname && $ohvalue > 0) {
10310 if (preg_match(
'/^html_(.*)$/i', $ohname, $n)) {
10315 if (isset($this->pageHTMLheaders[
$name])) {
10316 $this->HTMLHeader = $this->pageHTMLheaders[
$name];
10318 $this->HTMLHeader =
'';
10320 $resetHTMLHeadersrequired =
true;
10323 if ($ehvalue < 0 || strtoupper($ehvalue) ==
'OFF') {
10324 $this->HTMLHeaderE =
'';
10325 $resetHTMLHeadersrequired =
true;
10326 } elseif ($ehname && $ehvalue > 0) {
10327 if (preg_match(
'/^html_(.*)$/i', $ehname, $n)) {
10332 if (isset($this->pageHTMLheaders[
$name])) {
10333 $this->HTMLHeaderE = $this->pageHTMLheaders[
$name];
10335 $this->HTMLHeaderE =
'';
10337 $resetHTMLHeadersrequired =
true;
10340 if ($ofvalue < 0 || strtoupper($ofvalue) ==
'OFF') {
10341 $this->HTMLFooter =
'';
10342 $resetHTMLHeadersrequired =
true;
10343 } elseif ($ofname && $ofvalue > 0) {
10344 if (preg_match(
'/^html_(.*)$/i', $ofname, $n)) {
10349 if (isset($this->pageHTMLfooters[
$name])) {
10350 $this->HTMLFooter = $this->pageHTMLfooters[
$name];
10352 $this->HTMLFooter =
'';
10354 $resetHTMLHeadersrequired =
true;
10357 if ($efvalue < 0 || strtoupper($efvalue) ==
'OFF') {
10358 $this->HTMLFooterE =
'';
10359 $resetHTMLHeadersrequired =
true;
10360 } elseif ($efname && $efvalue > 0) {
10361 if (preg_match(
'/^html_(.*)$/i', $efname, $n)) {
10366 if (isset($this->pageHTMLfooters[
$name])) {
10367 $this->HTMLFooterE = $this->pageHTMLfooters[
$name];
10369 $this->HTMLFooterE =
'';
10371 $resetHTMLHeadersrequired =
true;
10374 if ($resetHTMLHeadersrequired) {
10375 $this->SetHTMLHeader($this->HTMLHeader);
10376 $this->SetHTMLHeader($this->HTMLHeaderE,
'E');
10377 $this->SetHTMLFooter($this->HTMLFooter);
10378 $this->SetHTMLFooter($this->HTMLFooterE,
'E');
10382 if (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
10383 $this->_setAutoHeaderHeight($this->HTMLHeaderE);
10384 $this->_setAutoFooterHeight($this->HTMLFooterE);
10386 $this->_setAutoHeaderHeight($this->HTMLHeader);
10387 $this->_setAutoFooterHeight($this->HTMLFooter);
10391 $this->y0 = $this->tMargin;
10393 $this->x = $this->lMargin;
10394 $this->y = $this->tMargin;
10401 if ($this->HTMLHeader ===
'' && $this->HTMLHeaderE ===
'') {
10405 if ($this->setAutoTopMargin ==
'pad') {
10406 if (isset($htmlh[
'h']) && $htmlh[
'h']) {
10412 $this->tMargin = $this->margin_header + $h + $this->orig_tMargin;
10413 } elseif ($this->setAutoTopMargin ==
'stretch') {
10414 if (isset($htmlh[
'h']) && $htmlh[
'h']) {
10420 $this->tMargin = max($this->orig_tMargin, $this->margin_header + $h + $this->autoMarginPadding);
10428 if ($this->HTMLFooter ===
'' && $this->HTMLFooterE ===
'') {
10432 if ($this->setAutoBottomMargin ==
'pad') {
10433 if (isset($htmlf[
'h']) && $htmlf[
'h']) {
10439 $this->bMargin = $this->margin_footer + $h + $this->orig_bMargin;
10440 $this->PageBreakTrigger = $this->h - $this->bMargin;
10441 } elseif ($this->setAutoBottomMargin ==
'stretch') {
10442 if (isset($htmlf[
'h']) && $htmlf[
'h']) {
10448 $this->bMargin = max($this->orig_bMargin, $this->margin_footer + $h + $this->autoMarginPadding);
10449 $this->PageBreakTrigger = $this->h - $this->bMargin;
10456 $this->printfloatbuffer();
10459 if ($this->visibility !=
'visible') {
10460 $this->SetVisibility(
'visible');
10471 $w = ($this->GetStringWidth($txt,
false, $OTLdata, $textvar) * Mpdf::SCALE) + ($this->charspacing * mb_strlen($txt, $this->mb_enc)) + ( $this->ws * mb_substr_count($txt,
' ', $this->mb_enc));
10473 return sprintf(
'%.3F %.3F m %.3F %.3F l S', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, ($x * Mpdf::SCALE) + $w, ($this->h - $y) * Mpdf::SCALE);
10481 function watermark($texte, $angle = 45, $fontsize = 96, $alpha = 0.2)
10483 if ($this->PDFA || $this->PDFX) {
10484 throw new \Mpdf\MpdfException(
'PDFA and PDFX do not permit transparency, so mPDF does not allow Watermarks!');
10487 if (!$this->watermark_font) {
10488 $this->watermark_font = $this->default_font;
10491 $this->
SetFont($this->watermark_font,
"B", $fontsize,
false);
10492 $texte = $this->purify_utf8_text($texte);
10494 if ($this->text_input_as_HTML) {
10495 $texte = $this->all_entities_to_utf8($texte);
10498 if ($this->usingCoreFont) {
10499 $texte = mb_convert_encoding($texte, $this->mb_enc,
'UTF-8');
10503 if (preg_match(
"/([" . $this->pregRTLchars .
"])/u", $texte)) {
10504 $this->biDirectional =
true;
10508 $save_OTLtags = $this->OTLtags;
10509 $this->OTLtags = [];
10510 if ($this->useKerning) {
10511 if ($this->CurrentFont[
'haskernGPOS']) {
10512 $this->OTLtags[
'Plus'] .=
' kern';
10520 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
10521 $texte = $this->otl->applyOTL($texte, $this->CurrentFont[
'useOTL']);
10522 $OTLdata = $this->otl->OTLdata;
10525 $this->OTLtags = $save_OTLtags;
10527 $this->magic_reverse_dir($texte, $this->directionality, $OTLdata);
10529 $this->SetAlpha($alpha);
10531 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
10533 $szfont = $fontsize;
10535 $maxlen = (min($this->w, $this->h) );
10537 while ($loop == 0) {
10538 $this->
SetFont($this->watermark_font,
"B", $szfont,
false);
10539 $offset = ((sin(deg2rad($angle))) * ($szfont / Mpdf::SCALE));
10541 $strlen = $this->GetStringWidth($texte,
true, $OTLdata, $textvar);
10542 if ($strlen > $maxlen - $offset) {
10549 $this->
SetFont($this->watermark_font,
"B", $szfont - 0.1,
true,
true);
10552 $adj = ((cos(deg2rad($angle))) * ($strlen / 2));
10553 $opp = ((sin(deg2rad($angle))) * ($strlen / 2));
10555 $wx = ($this->w / 2) - $adj + $offset / 3;
10556 $wy = ($this->h / 2) + $opp;
10558 $this->Rotate($angle, $wx, $wy);
10559 $this->Text($wx, $wy, $texte, $OTLdata, $textvar);
10561 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
10563 $this->SetAlpha(1);
10568 if ($this->PDFA || $this->PDFX) {
10569 throw new \Mpdf\MpdfException(
'PDFA and PDFX do not permit transparency, so mPDF does not allow Watermarks!');
10572 if ($this->watermarkImgBehind) {
10573 $this->watermarkImgAlpha = $this->SetAlpha($alpha,
'Normal',
true);
10575 $this->SetAlpha($alpha, $this->watermarkImgAlphaBlend);
10578 $this->Image($src, 0, 0, 0, 0,
'',
'',
true,
true,
true);
10580 if (!$this->watermarkImgBehind) {
10581 $this->SetAlpha(1);
10595 if ($this->angle != 0) {
10596 $this->writer->write(
'Q');
10598 $this->angle = $angle;
10600 $angle*=M_PI / 180;
10603 $cx = $x * Mpdf::SCALE;
10604 $cy = ($this->h - $y) * Mpdf::SCALE;
10605 $this->writer->write(sprintf(
'q %.5F %.5F %.5F %.5F %.3F %.3F cm 1 0 0 1 %.3F %.3F cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
10609 function CircularText($x, $y, $r, $text, $align =
'top', $fontfamily =
'', $fontsize = 0, $fontstyle =
'', $kerning = 120, $fontwidth = 100, $divider =
'')
10611 if (empty($this->directWrite)) {
10612 $this->directWrite =
new DirectWrite($this, $this->otl, $this->sizeConverter, $this->colorConverter);
10615 $this->directWrite->CircularText($x, $y, $r, $text, $align, $fontfamily, $fontsize, $fontstyle, $kerning, $fontwidth, $divider);
10623 if ($style ==
'F') {
10625 } elseif ($style ==
'FD' or $style ==
'DF') {
10631 $MyArc = 4 / 3 * (sqrt(2) - 1);
10632 $this->writer->write(sprintf(
'%.3F %.3F m', ($x + $r) * Mpdf::SCALE, ($hp - $y) * Mpdf::SCALE));
10633 $xc = $x + $w - $r;
10635 $this->writer->write(sprintf(
'%.3F %.3F l', $xc * Mpdf::SCALE, ($hp - $y) * Mpdf::SCALE));
10637 $this->_Arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
10638 $xc = $x + $w - $r;
10639 $yc = $y + $h - $r;
10640 $this->writer->write(sprintf(
'%.3F %.3F l', ($x + $w) * Mpdf::SCALE, ($hp - $yc) * Mpdf::SCALE));
10642 $this->_Arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
10644 $yc = $y + $h - $r;
10645 $this->writer->write(sprintf(
'%.3F %.3F l', $xc * Mpdf::SCALE, ($hp - ($y + $h)) * Mpdf::SCALE));
10647 $this->_Arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
10650 $this->writer->write(sprintf(
'%.3F %.3F l', ($x) * Mpdf::SCALE, ($hp - $yc) * Mpdf::SCALE));
10652 $this->_Arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
10653 $this->writer->write($op);
10656 function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
10659 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c ', $x1 * Mpdf::SCALE, ($h - $y1) * Mpdf::SCALE, $x2 * Mpdf::SCALE, ($h - $y2) * Mpdf::SCALE, $x3 * Mpdf::SCALE, ($h - $y3) * Mpdf::SCALE));
10667 function Shaded_box($text, $font =
'', $fontstyle =
'B', $szfont =
'', $width =
'70%', $style =
'DF', $radius = 2.5, $fill =
'#FFFFFF', $color =
'#000000', $pad = 2)
10670 if (empty($this->directWrite)) {
10671 $this->directWrite =
new DirectWrite($this, $this->otl, $this->sizeConverter, $this->colorConverter);
10673 $this->directWrite->Shaded_box($text, $font, $fontstyle, $szfont, $width, $style, $radius, $fill, $color, $pad);
10681 $len = strlen($str);
10682 for ($i = 0; $i < $len; $i++) {
10684 $h = ord($str[$i]);
10687 } elseif ($h >= 0xC2) {
10688 if (($h <= 0xDF) && ($i < $len - 1)) {
10689 $uni = ($h & 0x1F) << 6 | (ord($str[++$i]) & 0x3F);
10690 } elseif (($h <= 0xEF) && ($i < $len - 2)) {
10691 $uni = ($h & 0x0F) << 12 | (ord($str[++$i]) & 0x3F) << 6 | (ord($str[++$i]) & 0x3F);
10692 } elseif (($h <= 0xF4) && ($i < $len - 3)) {
10693 $uni = ($h & 0x0F) << 18 | (ord($str[++$i]) & 0x3F) << 12 | (ord($str[++$i]) & 0x3F) << 6 | (ord($str[++$i]) & 0x3F);
10698 if ($addSubset && isset($this->CurrentFont[
'subset'])) {
10699 $this->CurrentFont[
'subset'][$uni] = $uni;
10712 $unicode = $this->UTF8StringToArray($str);
10713 $orig_fid = $this->CurrentFont[
'subsetfontids'][0];
10714 $last_fid = $this->CurrentFont[
'subsetfontids'][0];
10715 foreach ($unicode as $c) {
10727 if (!$this->_charDefined($this->CurrentFont[
'cw'], $c)) {
10730 for ($i = 0; $i < 99; $i++) {
10732 $init = array_search($c, $this->CurrentFont[
'subsets'][$i]);
10733 if ($init !==
false) {
10734 if ($this->CurrentFont[
'subsetfontids'][$i] != $last_fid) {
10735 $ret .=
'> Tj /F' . $this->CurrentFont[
'subsetfontids'][$i] .
' ' . $this->FontSizePt .
' Tf <';
10736 $last_fid = $this->CurrentFont[
'subsetfontids'][$i];
10738 $ret .= sprintf(
"%02s", strtoupper(dechex($init)));
10741 elseif (count($this->CurrentFont[
'subsets'][$i]) < 255) {
10742 $n = count($this->CurrentFont[
'subsets'][$i]);
10743 $this->CurrentFont[
'subsets'][$i][$n] = $c;
10744 if ($this->CurrentFont[
'subsetfontids'][$i] != $last_fid) {
10745 $ret .=
'> Tj /F' . $this->CurrentFont[
'subsetfontids'][$i] .
' ' . $this->FontSizePt .
' Tf <';
10746 $last_fid = $this->CurrentFont[
'subsetfontids'][$i];
10748 $ret .= sprintf(
"%02s", strtoupper(dechex($n)));
10750 } elseif (!isset($this->CurrentFont[
'subsets'][($i + 1)])) {
10752 $this->CurrentFont[
'subsets'][($i + 1)] = [0 => 0];
10753 $new_fid = count($this->fonts) + $this->extraFontSubsets + 1;
10754 $this->CurrentFont[
'subsetfontids'][($i + 1)] = $new_fid;
10755 $this->extraFontSubsets++;
10760 if ($last_fid != $orig_fid) {
10761 $ret .=
' Tj /F' . $orig_fid .
' ' . $this->FontSizePt .
' Tf <> ';
10771 $fontkey = strtolower($family) . strtoupper($style);
10772 if (isset($this->fonts[$fontkey])) {
10773 throw new \Mpdf\MpdfException(
"Font already added: $family $style");
10775 $i = count($this->fonts) + $this->extraFontSubsets + 1;
10777 if ($family ==
'sjis') {
10783 $this->fonts[$fontkey] = [
'i' => $i,
'type' =>
'Type0',
'name' =>
$name,
'up' =>
$up,
'ut' => 40,
'cw' =>
$cw,
'CMap' => $CMap,
'registry' => $registry,
'MissingWidth' => 1000,
'desc' =>
$desc];
10789 if ($this->PDFA || $this->PDFX) {
10790 throw new \Mpdf\MpdfException(
"Adobe CJK fonts cannot be embedded in mPDF (required for PDFA1-b and PDFX/1-a).");
10792 if ($family ==
'big5') {
10793 $this->AddBig5Font();
10794 } elseif ($family ==
'gb') {
10795 $this->AddGBFont();
10796 } elseif ($family ==
'sjis') {
10797 $this->AddSJISFont();
10798 } elseif ($family ==
'uhc') {
10799 $this->AddUHCFont();
10807 $name =
'MSungStd-Light-Acro';
10808 $cw = $this->Big5_widths;
10809 $CMap =
'UniCNS-UTF16-H';
10810 $registry = [
'ordering' =>
'CNS1',
'supplement' => 4];
10814 'CapHeight' => 880,
10816 'FontBBox' =>
'[-160 -249 1015 1071]',
10817 'ItalicAngle' => 0,
10820 $this->AddCIDFont($family,
'',
$name,
$cw, $CMap, $registry,
$desc);
10821 $this->AddCIDFont($family,
'B',
$name .
',Bold',
$cw, $CMap, $registry,
$desc);
10822 $this->AddCIDFont($family,
'I',
$name .
',Italic',
$cw, $CMap, $registry,
$desc);
10823 $this->AddCIDFont($family,
'BI',
$name .
',BoldItalic',
$cw, $CMap, $registry,
$desc);
10830 $name =
'STSongStd-Light-Acro';
10831 $cw = $this->GB_widths;
10832 $CMap =
'UniGB-UTF16-H';
10833 $registry = [
'ordering' =>
'GB1',
'supplement' => 4];
10837 'CapHeight' => 737,
10839 'FontBBox' =>
'[-25 -254 1000 880]',
10840 'ItalicAngle' => 0,
10842 'Style' =>
'<< /Panose <000000000400000000000000> >>',
10844 $this->AddCIDFont($family,
'',
$name,
$cw, $CMap, $registry,
$desc);
10845 $this->AddCIDFont($family,
'B',
$name .
',Bold',
$cw, $CMap, $registry,
$desc);
10846 $this->AddCIDFont($family,
'I',
$name .
',Italic',
$cw, $CMap, $registry,
$desc);
10847 $this->AddCIDFont($family,
'BI',
$name .
',BoldItalic',
$cw, $CMap, $registry,
$desc);
10854 $name =
'KozMinPro-Regular-Acro';
10855 $cw = $this->SJIS_widths;
10856 $CMap =
'UniJIS-UTF16-H';
10857 $registry = [
'ordering' =>
'Japan1',
'supplement' => 5];
10861 'CapHeight' => 740,
10863 'FontBBox' =>
'[-195 -272 1110 1075]',
10864 'ItalicAngle' => 0,
10868 $this->AddCIDFont($family,
'',
$name,
$cw, $CMap, $registry,
$desc);
10869 $this->AddCIDFont($family,
'B',
$name .
',Bold',
$cw, $CMap, $registry,
$desc);
10870 $this->AddCIDFont($family,
'I',
$name .
',Italic',
$cw, $CMap, $registry,
$desc);
10871 $this->AddCIDFont($family,
'BI',
$name .
',BoldItalic',
$cw, $CMap, $registry,
$desc);
10878 $name =
'HYSMyeongJoStd-Medium-Acro';
10879 $cw = $this->UHC_widths;
10880 $CMap =
'UniKS-UTF16-H';
10881 $registry = [
'ordering' =>
'Korea1',
'supplement' => 2];
10885 'CapHeight' => 720,
10887 'FontBBox' =>
'[-28 -148 1001 880]',
10888 'ItalicAngle' => 0,
10890 'Style' =>
'<< /Panose <000000000600000000000000> >>',
10892 $this->AddCIDFont($family,
'',
$name,
$cw, $CMap, $registry,
$desc);
10893 $this->AddCIDFont($family,
'B',
$name .
',Bold',
$cw, $CMap, $registry,
$desc);
10894 $this->AddCIDFont($family,
'I',
$name .
',Italic',
$cw, $CMap, $registry,
$desc);
10895 $this->AddCIDFont($family,
'BI',
$name .
',BoldItalic',
$cw, $CMap, $registry,
$desc);
10911 if ($this->PDFA || $this->PDFX) {
10912 if (strtolower($font) ==
'ctimes') {
10915 if (strtolower($font) ==
'ccourier') {
10916 $font =
'monospace';
10918 if (strtolower($font) ==
'chelvetica') {
10919 $font =
'sans-serif';
10922 $font = $this->
SetFont($font);
10923 $this->default_font = $font;
10924 $this->original_default_font = $font;
10925 if (!$this->watermark_font) {
10926 $this->watermark_font = $font;
10928 $this->defaultCSS[
'BODY'][
'FONT-FAMILY'] = $font;
10929 $this->cssManager->CSS[
'BODY'][
'FONT-FAMILY'] = $font;
10934 $this->default_font_size = $fontsize;
10935 $this->original_default_font_size = $fontsize;
10937 $this->defaultCSS[
'BODY'][
'FONT-SIZE'] = $fontsize .
'pt';
10938 $this->cssManager->CSS[
'BODY'][
'FONT-SIZE'] = $fontsize .
'pt';
10944 $this->defaultCSS[
'BODY'][strtoupper($prop)] = $val;
10945 $this->cssManager->CSS[
'BODY'][strtoupper($prop)] = $val;
10952 if (strtolower($dir) ==
'rtl') {
10953 if ($this->directionality !=
'rtl') {
10955 $tmp = $this->DeflMargin;
10956 $this->DeflMargin = $this->DefrMargin;
10957 $this->DefrMargin = $tmp;
10958 $this->orig_lMargin = $this->DeflMargin;
10959 $this->orig_rMargin = $this->DefrMargin;
10961 $this->SetMargins($this->DeflMargin, $this->DefrMargin, $this->tMargin);
10963 $this->directionality =
'rtl';
10964 $this->defaultAlign =
'R';
10965 $this->defaultTableAlign =
'R';
10968 $this->directionality =
'ltr';
10969 $this->defaultAlign =
'L';
10970 $this->defaultTableAlign =
'L';
10972 $this->cssManager->CSS[
'BODY'][
'DIRECTION'] = $this->directionality;
10979 if (preg_match(
'/^[0-9\.,]*$/', $v) && $v >= 0) {
10981 } elseif (strtoupper($v) ==
'NORMAL' || $v ==
'N') {
10984 $tlh = $this->sizeConverter->convert($v, $this->FontSize, $this->FontSize,
true);
10986 return ($tlh .
'mm');
10989 return $this->normalLineheight;
10995 $desc = $this->CurrentFont[
'desc'];
10997 if (!isset(
$desc[
'Leading'])) {
10998 $desc[
'Leading'] = 0;
11000 if ($this->useFixedNormalLineHeight) {
11001 $lh = $this->normalLineheight;
11002 } elseif (isset(
$desc[
'Ascent']) &&
$desc[
'Ascent']) {
11003 $lh = ($this->adjustFontDescLineheight * (
$desc[
'Ascent'] -
$desc[
'Descent'] +
$desc[
'Leading']) / 1000);
11005 $lh = $this->normalLineheight;
11014 $FontPt = $this->FontSizePt;
11016 $fs = $FontPt / Mpdf::SCALE;
11017 $this->lineheight = $this->_computeLineheight($lh, $fs);
11022 if ($this->shrin_k > 1) {
11023 $k = $this->shrin_k;
11028 $fs = $this->FontSize;
11031 $lh = $this->_getNormalLineheight();
11033 if (preg_match(
'/mm/', $lh)) {
11034 return (((
float) $lh) / $k);
11035 } elseif ($lh > 0) {
11036 return ($fs * $lh);
11038 return ($fs * $this->normalLineheight);
11041 function _setLineYpos(&$fontsize, &$fontdesc, &$CSSlineheight, $blockYpos =
false)
11043 $ypos[
'glyphYorigin'] = 0;
11044 $ypos[
'baseline-shift'] = 0;
11048 if (isset($fontdesc[
'Ascent']) && $fontdesc[
'Ascent'] && !$this->useFixedTextBaseline) {
11050 $ypos[
'boxtop'] = $fontdesc[
'Ascent'] / 1000 * $fontsize;
11051 $ypos[
'boxbottom'] = $fontdesc[
'Descent'] / 1000 * $fontsize;
11052 if (isset($fontdesc[
'Leading'])) {
11053 $linegap = $fontdesc[
'Leading'] / 1000 * $fontsize;
11057 $ypos[
'boxtop'] = (0.5 + $this->baselineC) * $fontsize;
11058 $ypos[
'boxbottom'] = -(0.5 - $this->baselineC) * $fontsize;
11060 $fontheight = $ypos[
'boxtop'] - $ypos[
'boxbottom'];
11062 if ($this->shrin_k > 1) {
11063 $shrin_k = $this->shrin_k;
11069 if ($CSSlineheight ==
'N') {
11070 $lh = $this->_getNormalLineheight($fontdesc);
11071 $lineheight = ($fontsize * $lh);
11072 $leading += $linegap;
11073 } elseif (preg_match(
'/mm/', $CSSlineheight)) {
11074 $lineheight = (((float) $CSSlineheight) / $shrin_k);
11077 elseif ($CSSlineheight > 0) {
11078 $lineheight = ($fontsize * $CSSlineheight);
11080 $lineheight = ($fontsize * $this->normalLineheight);
11087 if (preg_match(
'/mm/', $CSSlineheight)
11088 && ($blockYpos && $ypos[
'boxtop'] < $blockYpos[
'boxtop'])
11089 && ($blockYpos && $ypos[
'boxbottom'] > $blockYpos[
'boxbottom'])) {
11091 $ypos[
'exttop'] = $blockYpos[
'exttop'];
11092 $ypos[
'extbottom'] = $blockYpos[
'extbottom'];
11096 $leading += ($lineheight - $fontheight);
11098 $ypos[
'exttop'] = $ypos[
'boxtop'] + $leading / 2;
11099 $ypos[
'extbottom'] = $ypos[
'boxbottom'] - $leading / 2;
11117 if ($this->shrin_k > 1) {
11118 $shrin_k = $this->shrin_k;
11129 $fontsize = $this->FontSize;
11130 $fontkey = $this->FontFamily . $this->FontStyle;
11131 $fontdesc = $this->fonts[$fontkey][
'desc'];
11132 $CSSlineheight = $this->cellLineHeight;
11133 $line_stacking_strategy = $this->cellLineStackingStrategy;
11134 $line_stacking_shift = $this->cellLineStackingShift;
11137 $fontsize = $this->blk[$this->blklvl][
'InlineProperties'][
'size'];
11138 $fontkey = $this->blk[$this->blklvl][
'InlineProperties'][
'family'] . $this->blk[$this->blklvl][
'InlineProperties'][
'style'];
11139 $fontdesc = $this->fonts[$fontkey][
'desc'];
11140 $CSSlineheight = $this->blk[$this->blklvl][
'line_height'];
11142 $line_stacking_strategy = (isset($this->blk[$this->blklvl][
'line_stacking_strategy']) ? $this->blk[$this->blklvl][
'line_stacking_strategy'] :
'inline-line-height');
11144 $line_stacking_shift = (isset($this->blk[$this->blklvl][
'line_stacking_shift']) ? $this->blk[$this->blklvl][
'line_stacking_shift'] :
'consider-shifts');
11146 $boxLineHeight = $this->_computeLineheight($CSSlineheight, $fontsize);
11150 $ypos[-1] = $this->_setLineYpos($fontsize, $fontdesc, $CSSlineheight);
11153 if ($line_stacking_strategy ==
'block-line-height') {
11154 $topy = $ypos[-1][
'exttop'];
11155 $bottomy = $ypos[-1][
'extbottom'];
11162 $midpoint = $ypos[-1][
'boxtop'] - (($ypos[-1][
'boxtop'] - $ypos[-1][
'boxbottom']) / 2);
11167 foreach ($content as $k => $chunk) {
11168 if (isset($this->objectbuffer[$k]) && $this->objectbuffer[$k][
'type'] ==
'listmarker') {
11169 $ypos[$k] = $ypos[-1];
11171 if ($line_stacking_strategy ==
'block-line-height' || $line_stacking_strategy ==
'grid-height' || $line_stacking_strategy ==
'max-height') {
11172 if ($ypos[$k][
'boxtop'] > $topy) {
11173 $topy = $ypos[$k][
'boxtop'];
11175 if ($ypos[$k][
'boxbottom'] < $bottomy) {
11176 $bottomy = $ypos[$k][
'boxbottom'];
11179 if ($ypos[$k][
'exttop'] > $topy) {
11180 $topy = $ypos[$k][
'exttop'];
11182 if ($ypos[$k][
'extbottom'] < $bottomy) {
11183 $bottomy = $ypos[$k][
'extbottom'];
11186 } elseif (isset($this->objectbuffer[$k]) && $this->objectbuffer[$k][
'type'] ==
'dottab') {
11187 $fontsize = $font[$k][
'size'];
11188 $fontdesc = $font[$k][
'curr'][
'desc'];
11190 $ypos[$k] = $this->_setLineYpos($fontsize, $fontdesc, $lh, $ypos[-1]);
11191 } elseif (isset($this->objectbuffer[$k])) {
11192 $oh = $this->objectbuffer[$k][
'OUTER-HEIGHT'];
11193 $va = $this->objectbuffer[$k][
'vertical-align'];
11199 } elseif ($va ==
'M') {
11200 if (($midpoint + $oh / 2) > $topy) {
11201 $topy = $midpoint + $oh / 2;
11203 if (($midpoint - $oh / 2) < $bottomy) {
11204 $bottomy = $midpoint - $oh / 2;
11206 } elseif ($va ==
'TT') {
11207 if (($ypos[-1][
'boxtop'] - $oh) < $bottomy) {
11208 $bottomy = $ypos[-1][
'boxtop'] - $oh;
11209 $topy = max($topy, $ypos[-1][
'boxtop']);
11211 } elseif ($va ==
'TB') {
11212 if (($ypos[-1][
'boxbottom'] + $oh) > $topy) {
11213 $topy = $ypos[-1][
'boxbottom'] + $oh;
11214 $bottomy = min($bottomy, $ypos[-1][
'boxbottom']);
11216 } elseif ($va ==
'T') {
11220 } elseif ($va ==
'B') {
11225 } elseif ($content[$k] || $content[$k] ===
'0') {
11227 $fontsize = $font[$k][
'size'];
11228 $fontdesc = $font[$k][
'curr'][
'desc'];
11230 $ypos[$k] = $this->_setLineYpos($fontsize, $fontdesc, $CSSlineheight, $ypos[-1]);
11232 if (isset($font[$k][
'textparam'][
'text-baseline']) && $font[$k][
'textparam'][
'text-baseline'] != 0) {
11233 $ypos[$k][
'baseline-shift'] = $font[$k][
'textparam'][
'text-baseline'];
11240 if ($line_stacking_strategy ==
'block-line-height' || $line_stacking_strategy ==
'grid-height' || $line_stacking_strategy ==
'max-height') {
11241 if ($line_stacking_shift ==
'disregard-shifts') {
11242 if ($ypos[$k][
'boxtop'] > $topy) {
11243 $topy = $ypos[$k][
'boxtop'];
11245 if ($ypos[$k][
'boxbottom'] < $bottomy) {
11246 $bottomy = $ypos[$k][
'boxbottom'];
11249 if (($ypos[$k][
'boxtop'] + $ypos[$k][
'baseline-shift']) > $topy) {
11250 $topy = $ypos[$k][
'boxtop'] + $ypos[$k][
'baseline-shift'];
11252 if (($ypos[$k][
'boxbottom'] + $ypos[$k][
'baseline-shift']) < $bottomy) {
11253 $bottomy = $ypos[$k][
'boxbottom'] + $ypos[$k][
'baseline-shift'];
11257 if ($line_stacking_shift ==
'disregard-shifts') {
11258 if ($ypos[$k][
'exttop'] > $topy) {
11259 $topy = $ypos[$k][
'exttop'];
11261 if ($ypos[$k][
'extbottom'] < $bottomy) {
11262 $bottomy = $ypos[$k][
'extbottom'];
11265 if (($ypos[$k][
'exttop'] + $ypos[$k][
'baseline-shift']) > $topy) {
11266 $topy = $ypos[$k][
'exttop'] + $ypos[$k][
'baseline-shift'];
11268 if (($ypos[$k][
'extbottom'] + $ypos[$k][
'baseline-shift']) < $bottomy) {
11269 $bottomy = $ypos[$k][
'extbottom'] + $ypos[$k][
'baseline-shift'];
11275 if (isset($font[$k][
'bord']) && $font[$k][
'bord']) {
11276 $bordfontsize = $font[$k][
'textparam'][
'bord-decoration'][
'fontsize'] / $shrin_k;
11277 $bordfontkey = $font[$k][
'textparam'][
'bord-decoration'][
'fontkey'];
11278 if ($bordfontkey != $fontkey || $bordfontsize != $fontsize || isset($font[$k][
'textparam'][
'bord-decoration'][
'baseline'])) {
11279 $bordfontdesc = $this->fonts[$bordfontkey][
'desc'];
11280 $bordypos[$k] = $this->_setLineYpos($bordfontsize, $bordfontdesc, $CSSlineheight, $ypos[-1]);
11281 if (isset($font[$k][
'textparam'][
'bord-decoration'][
'baseline']) && $font[$k][
'textparam'][
'bord-decoration'][
'baseline'] != 0) {
11282 $bordypos[$k][
'baseline-shift'] = $font[$k][
'textparam'][
'bord-decoration'][
'baseline'] / $shrin_k;
11287 if (isset($font[$k][
'spanbgcolor']) && $font[$k][
'spanbgcolor']) {
11288 $bgfontsize = $font[$k][
'textparam'][
'bg-decoration'][
'fontsize'] / $shrin_k;
11289 $bgfontkey = $font[$k][
'textparam'][
'bg-decoration'][
'fontkey'];
11290 if ($bgfontkey != $fontkey || $bgfontsize != $fontsize || isset($font[$k][
'textparam'][
'bg-decoration'][
'baseline'])) {
11291 $bgfontdesc = $this->fonts[$bgfontkey][
'desc'];
11292 $bgypos[$k] = $this->_setLineYpos($bgfontsize, $bgfontdesc, $CSSlineheight, $ypos[-1]);
11293 if (isset($font[$k][
'textparam'][
'bg-decoration'][
'baseline']) && $font[$k][
'textparam'][
'bg-decoration'][
'baseline'] != 0) {
11294 $bgypos[$k][
'baseline-shift'] = $font[$k][
'textparam'][
'bg-decoration'][
'baseline'] / $shrin_k;
11303 if ($mta > ($topy - $bottomy)) {
11304 if (($topy - $mta) < $bottomy) {
11305 $bottomy = $topy - $mta;
11308 if ($mba > ($topy - $bottomy)) {
11309 if (($bottomy + $mba) > $topy) {
11310 $topy = $bottomy + $mba;
11314 if ($line_stacking_strategy ==
'block-line-height') {
11315 $topy = $ypos[-1][
'exttop'];
11316 $bottomy = $ypos[-1][
'extbottom'];
11319 $inclusiveHeight = $topy - $bottomy;
11324 if ($line_stacking_strategy ==
'block-line-height') {
11325 $stackHeight = $boxLineHeight;
11326 } elseif ($line_stacking_strategy ==
'max-height') {
11328 $stackHeight = $inclusiveHeight;
11329 } elseif ($line_stacking_strategy ==
'grid-height') {
11331 $stackHeight = $boxLineHeight;
11332 while ($stackHeight < $inclusiveHeight) {
11333 $stackHeight += $boxLineHeight;
11337 $stackHeight = $inclusiveHeight;
11340 $diff = $stackHeight - $inclusiveHeight;
11341 $topy += $diff / 2;
11342 $bottomy -= $diff / 2;
11346 $lineBox[-1][
'boxtop'] = $topy - $ypos[-1][
'boxtop'];
11347 $lineBox[-1][
'boxbottom'] = $topy - $ypos[-1][
'boxbottom'];
11350 $lineBox[-1][
'glyphYorigin'] = $topy - $ypos[-1][
'glyphYorigin'];
11351 $lineBox[-1][
'baseline-shift'] = $ypos[-1][
'baseline-shift'];
11353 $midpoint = $lineBox[-1][
'boxbottom'] - (($lineBox[-1][
'boxbottom'] - $lineBox[-1][
'boxtop']) / 2);
11355 foreach ($content as $k => $chunk) {
11356 if (isset($this->objectbuffer[$k])) {
11357 $oh = $this->objectbuffer[$k][
'OUTER-HEIGHT'];
11359 if ($this->objectbuffer[$k][
'type'] ==
'listmarker') {
11361 } elseif ($this->objectbuffer[$k][
'type'] ==
'dottab') {
11362 $oh = $font[$k][
'size'];
11363 $lineBox[$k][
'boxtop'] = $topy - $ypos[$k][
'boxtop'];
11364 $lineBox[$k][
'boxbottom'] = $topy - $ypos[$k][
'boxbottom'];
11365 $lineBox[$k][
'glyphYorigin'] = $topy - $ypos[$k][
'glyphYorigin'];
11366 $lineBox[$k][
'baseline-shift'] = 0;
11369 $va = $this->objectbuffer[$k][
'vertical-align'];
11372 $lineBox[$k][
'top'] = $lineBox[-1][
'glyphYorigin'] - $oh;
11373 } elseif ($va ==
'M') {
11374 $lineBox[$k][
'top'] = $midpoint - $oh / 2;
11375 } elseif ($va ==
'TT') {
11376 $lineBox[$k][
'top'] = $lineBox[-1][
'boxtop'];
11377 } elseif ($va ==
'TB') {
11378 $lineBox[$k][
'top'] = $lineBox[-1][
'boxbottom'] - $oh;
11379 } elseif ($va ==
'T') {
11380 $lineBox[$k][
'top'] = 0;
11381 } elseif ($va ==
'B') {
11382 $lineBox[$k][
'top'] = $stackHeight - $oh;
11384 } elseif ($content[$k] || $content[$k] ===
'0') {
11385 $lineBox[$k][
'boxtop'] = $topy - $ypos[$k][
'boxtop'];
11386 $lineBox[$k][
'boxbottom'] = $topy - $ypos[$k][
'boxbottom'];
11389 $lineBox[$k][
'glyphYorigin'] = $topy - $ypos[$k][
'glyphYorigin'];
11390 $lineBox[$k][
'baseline-shift'] = $ypos[$k][
'baseline-shift'];
11391 if (isset($bordypos[$k][
'boxtop'])) {
11392 $lineBox[$k][
'border-boxtop'] = $topy - $bordypos[$k][
'boxtop'];
11393 $lineBox[$k][
'border-boxbottom'] = $topy - $bordypos[$k][
'boxbottom'];
11394 $lineBox[$k][
'border-baseline-shift'] = $bordypos[$k][
'baseline-shift'];
11396 if (isset($bgypos[$k][
'boxtop'])) {
11397 $lineBox[$k][
'background-boxtop'] = $topy - $bgypos[$k][
'boxtop'];
11398 $lineBox[$k][
'background-boxbottom'] = $topy - $bgypos[$k][
'boxbottom'];
11399 $lineBox[$k][
'background-baseline-shift'] = $bgypos[$k][
'baseline-shift'];
11407 if (isset($_SERVER[
'HTTP_HOST'])) {
11408 $host = $_SERVER[
'HTTP_HOST'];
11409 } elseif (isset($_SERVER[
'SERVER_NAME'])) {
11410 $host = $_SERVER[
'SERVER_NAME'];
11415 if (isset($_SERVER[
'SCRIPT_NAME'])) {
11416 $currentPath = dirname($_SERVER[
'SCRIPT_NAME']);
11418 $currentPath = dirname($_SERVER[
'PHP_SELF']);
11420 $currentPath = str_replace(
"\\",
"/", $currentPath);
11421 if ($currentPath ==
'/') {
11425 if (isset($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] && $_SERVER[
'HTTPS'] !==
'off') {
11426 $currpath =
'https://' . $host . $currentPath .
'/';
11428 $currpath =
'http://' . $host . $currentPath .
'/';
11433 $this->basepath = $currpath;
11434 $this->basepathIsLocal =
true;
11437 $str = preg_replace(
'/\?.*/',
'', $str);
11438 if (!preg_match(
'/(http|https|ftp):\/\/.*\//i', $str)) {
11442 $this->basepath = dirname($str) .
"/";
11443 $this->basepath = str_replace(
"\\",
"/", $this->basepath);
11444 $tr = parse_url($this->basepath);
11445 if (isset($tr[
'host']) && ($tr[
'host'] == $host)) {
11446 $this->basepathIsLocal =
true;
11448 $this->basepathIsLocal =
false;
11456 $basepath = $this->basepath;
11463 if (substr(
$path, 0, 2) ===
'//') {
11464 $scheme = parse_url($basepath, PHP_URL_SCHEME);
11465 $scheme = $scheme ?:
'http';
11471 if (substr(
$path, 0, 1) ==
'#') {
11476 $wrappers = stream_get_wrappers();
11477 $pattern = sprintf(
'@^(?!%s)[a-z0-9\.\-+]+:.*@i', implode(
'|', $wrappers));
11478 if (preg_match($pattern,
$path)) {
11482 if (substr(
$path, 0, 3) ==
"../") {
11484 $backtrackamount = substr_count(
$path,
"../");
11485 $maxbacktrack = substr_count($basepath,
"/") - 3;
11486 $filepath = str_replace(
"../",
'',
$path);
11490 if ($backtrackamount > $maxbacktrack) {
11491 $backtrackamount = $maxbacktrack;
11495 for ($i = 0; $i < $backtrackamount + 1; $i++) {
11501 } elseif ((strpos(
$path,
":/") ===
false || strpos(
$path,
":/") > 10) && !@is_file(
$path)) {
11503 if (substr(
$path, 0, 1) ==
"/") {
11505 $tr = parse_url($basepath);
11509 if (!empty($tr[
'scheme'])) {
11510 $root .= $tr[
'scheme'] .
'://';
11513 $root .= isset($tr[
'host']) ? $tr[
'host'] :
'';
11514 $root .= ((isset($tr[
'port']) && $tr[
'port']) ? (
':' . $tr[
'port']) :
'');
11528 $num = $this->page;
11531 $type = $this->defaultPageNumStyle;
11537 foreach ($this->PageNumSubstitutions as $psarr) {
11539 if ($num >= $psarr[
'from']) {
11541 if ($psarr[
'reset']) {
11542 if ($psarr[
'reset'] > 1) {
11543 $offset = $psarr[
'reset'] - 1;
11545 $ppgno = $num - $psarr[
'from'] + 1 + $offset;
11546 $lastreset = $psarr[
'from'];
11549 if ($psarr[
'type']) {
11550 $type = $psarr[
'type'];
11553 if (strtoupper($psarr[
'suppress']) ==
'ON' || $psarr[
'suppress'] == 1) {
11555 } elseif (strtoupper($psarr[
'suppress']) ==
'OFF') {
11565 $ppgno = $this->_getStyledNumber($ppgno, $type);
11568 $ppgno = $this->pagenumPrefix . $ppgno . $this->pagenumSuffix;
11577 $num = $this->page;
11580 $type = $this->defaultPageNumStyle;
11582 $ppgend = count($this->pages) + 1;
11586 foreach ($this->PageNumSubstitutions as $psarr) {
11587 if ($num >= $psarr[
'from']) {
11588 if ($psarr[
'reset']) {
11589 if ($psarr[
'reset'] > 1) {
11590 $offset = $psarr[
'reset'] - 1;
11592 $ppgstart = $psarr[
'from'] + $offset;
11593 $ppgend = count($this->pages) + 1 + $offset;
11595 if ($psarr[
'type']) {
11596 $type = $psarr[
'type'];
11598 if (strtoupper($psarr[
'suppress']) ==
'ON' || $psarr[
'suppress'] == 1) {
11600 } elseif (strtoupper($psarr[
'suppress']) ==
'OFF') {
11604 if ($num < $psarr[
'from']) {
11605 if ($psarr[
'reset']) {
11606 $ppgend = $psarr[
'from'] + $offset;
11616 $ppgno = $ppgend - $ppgstart + $offset;
11617 $ppgno = $this->_getStyledNumber($ppgno, $type);
11620 $ppgno = $this->pagenumPrefix . $ppgno . $this->pagenumSuffix;
11634 $checkfont =
false;
11643 $lowertype = strtolower($type);
11645 if ($lowertype ==
'upper-latin' || $lowertype ==
'upper-alpha' || $type ==
'A') {
11647 $ppgno = $decToAlpha->convert($ppgno,
true);
11649 } elseif ($lowertype ==
'lower-latin' || $lowertype ==
'lower-alpha' || $type ==
'a') {
11651 $ppgno = $decToAlpha->convert($ppgno,
false);
11653 } elseif ($lowertype ==
'upper-roman' || $type ==
'I') {
11655 $ppgno = $decToRoman->convert($ppgno,
true);
11657 } elseif ($lowertype ==
'lower-roman' || $type ==
'i') {
11659 $ppgno = $decToRoman->convert($ppgno,
false);
11661 } elseif ($lowertype ==
'hebrew') {
11663 $ppgno = $decToHebrew->convert($ppgno, $reverse);
11665 } elseif (preg_match(
'/(arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao|myanmar)/i', $lowertype, $m)) {
11667 $cp = $decToOther->getCodePage($m[1]);
11668 $ppgno = $decToOther->convert($ppgno, $cp, $checkfont);
11670 } elseif ($lowertype ==
'cjk-decimal') {
11672 $ppgno = $decToCjk->convert($ppgno);
11684 $num = $this->page;
11687 $type = $this->defaultPageNumStyle;
11693 foreach ($this->PageNumSubstitutions as $psarr) {
11694 if ($num >= $psarr[
'from']) {
11695 if ($psarr[
'reset']) {
11696 if ($psarr[
'reset'] > 1) {
11697 $offset = $psarr[
'reset'] - 1;
11699 $ppgno = $num - $psarr[
'from'] + 1 + $offset;
11701 if ($psarr[
'type']) {
11702 $type = $psarr[
'type'];
11704 if (strtoupper($psarr[
'suppress']) ==
'ON' || $psarr[
'suppress'] == 1) {
11706 } elseif (strtoupper($psarr[
'suppress']) ==
'OFF') {
11710 if ($num == $psarr[
'from']) {
11711 $reset = $psarr[
'reset'];
11721 return [$type, $suppress, $reset];
11726 $this->docTemplateStart = $this->page;
11733 $this->cMarginL = 0;
11734 $this->cMarginR = 0;
11737 if (($this->mirrorMargins && ($this->page % 2 == 0) && $this->HTMLHeaderE) || ($this->mirrorMargins && ($this->page % 2 == 1) && $this->HTMLHeader) || (!$this->mirrorMargins && $this->HTMLHeader)) {
11738 $this->writeHTMLHeaders();
11744 function TableHeaderFooter($content =
'', $tablestartpage =
'', $tablestartcolumn =
'', $horf =
'H', $level = 0, $firstSpread =
true, $finalSpread =
true)
11746 if (($horf ==
'H' || $horf ==
'F') && !empty($content)) {
11747 $table = &$this->table[1][1];
11750 if ($horf ==
'F') {
11751 $firstrow = count($table[
'cells']) - $table[
'footernrows'];
11752 $lastrow = count($table[
'cells']) - 1;
11755 $lastrow = $table[
'headernrows'] - 1;
11757 if (empty($content[$firstrow])) {
11758 if ($this->debug) {
11759 throw new \Mpdf\MpdfException(
"<tfoot> must precede <tbody> in a table");
11767 if ($horf ==
'H') {
11768 if ($table[
'borders_separate']) {
11769 $adv = $table[
'border_spacing_V'] / 2 + $table[
'border_details'][
'T'][
'w'] + $table[
'padding'][
'T'];
11771 $adv = $table[
'max_cell_border_width'][
'T'] / 2;
11774 if ($this->table_rotate) {
11775 $this->y += ($adv);
11777 $this->DivLn($adv, $this->blklvl,
true);
11782 $topy = $content[$firstrow][0][
'y'] - $this->y;
11784 for ($i = $firstrow; $i <= $lastrow; $i++) {
11789 if ($this->ColActive) {
11791 if ($this->blklvl > 0) {
11792 $firstblockfill = $this->GetFirstBlockFill();
11793 if ($firstblockfill && $this->blklvl >= $firstblockfill) {
11794 $divh = $content[$i][0][
'h'];
11796 $this->DivLn($divh, -3,
false);
11798 $bcor = $this->blk[$this->blklvl][
'bgcolorarray'];
11799 $this->SetFColor($bcor);
11807 foreach ($content[$i] as $tablehf) {
11813 if (($this->mirrorMargins) && ($tablestartpage ==
'ODD') && (($this->page) % 2 == 0)) {
11814 $x = $x + $this->MarginCorrection;
11815 } elseif (($this->mirrorMargins) && ($tablestartpage ==
'EVEN') && (($this->page) % 2 == 1)) {
11816 $x = $x + $this->MarginCorrection;
11820 if ($this->ColActive) {
11821 if ($this->directionality ==
'rtl') {
11822 $x -= ($this->CurrCol - $tablestartcolumn) * ($this->ColWidth + $this->ColGap);
11825 $x += ($this->CurrCol - $tablestartcolumn) * ($this->ColWidth + $this->ColGap);
11830 if ($colctr == 1) {
11835 if ($this->iterationCounter) {
11836 foreach ($tablehf[
'textbuffer'] as $k => $t) {
11837 if (!is_array($t[0]) && preg_match(
'/{iteration ([a-zA-Z0-9_]+)}/', $t[0], $m)) {
11838 $vname =
'__' . $m[1] .
'_';
11839 if (!isset($this->$vname)) {
11844 $tablehf[
'textbuffer'][$k][0] = preg_replace(
'/{iteration ' . $m[1] .
'}/', $this->$vname, $tablehf[
'textbuffer'][$k][0]);
11853 $direction =
Arrays::get($tablehf,
'direction',
null);
11856 $border_details =
Arrays::get($tablehf,
'border_details',
null);
11857 $padding =
Arrays::get($tablehf,
'padding',
null);
11858 $this->tabletheadjustfinished =
true;
11860 $textbuffer =
Arrays::get($tablehf,
'textbuffer',
null);
11864 $this->cellTextAlign = $align;
11866 $this->cellLineHeight =
Arrays::get($tablehf,
'cellLineHeight',
null);
11867 $this->cellLineStackingStrategy =
Arrays::get($tablehf,
'cellLineStackingStrategy',
null);
11868 $this->cellLineStackingShift =
Arrays::get($tablehf,
'cellLineStackingShift',
null);
11872 if ($this->ColActive) {
11873 if ($table[
'borders_separate']) {
11874 $tablefill = isset($table[
'bgcolor'][-1]) ? $table[
'bgcolor'][-1] : 0;
11876 $color = $this->colorConverter->convert($tablefill, $this->PDFAXwarnings);
11878 $xadj = ($table[
'border_spacing_H'] / 2);
11879 $yadj = ($table[
'border_spacing_V'] / 2);
11880 $wadj = $table[
'border_spacing_H'];
11881 $hadj = $table[
'border_spacing_V'];
11882 if ($i == $firstrow && $horf ==
'H') {
11883 $yadj += $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'];
11884 $hadj += $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'];
11886 if (($i == ($lastrow) || (isset($tablehf[
'rowspan']) && ($i + $tablehf[
'rowspan']) == ($lastrow + 1)) || (!isset($tablehf[
'rowspan']) && ($i + 1) == ($lastrow + 1))) && $horf ==
'F') {
11887 $hadj += $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'];
11889 if ($colctr == 1) {
11890 $xadj += $table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'];
11891 $wadj += $table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'];
11893 if ($colctr == count($content[$i])) {
11894 $wadj += $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'];
11896 $this->SetFColor($color);
11897 $this->Rect($x - $xadj, $y - $yadj, $w + $wadj, $h + $hadj,
'F');
11903 if ($table[
'empty_cells'] !=
'hide' || !empty($textbuffer) || !$table[
'borders_separate']) {
11906 $paintcell =
false;
11910 if ($R && intval($R) > 0 && isset($va) && $va !=
'B') {
11914 if (!isset($va) || empty($va) || $va ==
'M') {
11915 $this->y += ($h - $mih) / 2;
11916 } elseif (isset($va) && $va ==
'B') {
11917 $this->y += $h - $mih;
11923 if (isset($tablehf[
'bgcolor']) && $tablehf[
'bgcolor'] && $tablehf[
'bgcolor'] !=
'transparent') {
11924 $fill = $tablehf[
'bgcolor'];
11926 } elseif (isset($content[$i][0][
'trbgcolor']) && $content[$i][0][
'trbgcolor'] && $content[$i][0][
'trbgcolor'] !=
'transparent') {
11927 $fill = $content[$i][0][
'trbgcolor'];
11930 if ($fill && $paintcell) {
11931 $color = $this->colorConverter->convert($fill, $this->PDFAXwarnings);
11933 if ($table[
'borders_separate']) {
11934 if ($this->ColActive) {
11935 $this->SetFColor($color);
11936 $this->Rect($x + ($table[
'border_spacing_H'] / 2), $y + ($table[
'border_spacing_V'] / 2), $w - $table[
'border_spacing_H'], $h - $table[
'border_spacing_V'],
'F');
11938 $this->tableBackgrounds[$level * 9 + $leveladj][] = [
'gradient' =>
false,
'x' => ($x + ($table[
'border_spacing_H'] / 2)),
'y' => ($y + ($table[
'border_spacing_V'] / 2)),
'w' => ($w - $table[
'border_spacing_H']),
'h' => ($h - $table[
'border_spacing_V']),
'col' => $color];
11941 if ($this->ColActive) {
11942 $this->SetFColor($color);
11943 $this->Rect($x, $y, $w, $h,
'F');
11945 $this->tableBackgrounds[$level * 9 + $leveladj][] = [
'gradient' =>
false,
'x' => $x,
'y' => $y,
'w' => $w,
'h' => $h,
'col' => $color];
11953 if (isset($tablehf[
'gradient']) && $tablehf[
'gradient'] && $paintcell) {
11954 $g = $this->gradient->parseBackgroundGradient($tablehf[
'gradient']);
11956 if ($table[
'borders_separate']) {
11957 $px = $x + ($table[
'border_spacing_H'] / 2);
11958 $py = $y + ($table[
'border_spacing_V'] / 2);
11959 $pw = $w - $table[
'border_spacing_H'];
11960 $ph = $h - $table[
'border_spacing_V'];
11967 if ($this->ColActive) {
11968 $this->gradient->Gradient($px, $py, $pw, $ph, $g[
'type'], $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend']);
11970 $this->tableBackgrounds[$level * 9 + 7][] = [
'gradient' =>
true,
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
11975 if (isset($tablehf[
'background-image']) && $paintcell) {
11976 if ($tablehf[
'background-image'][
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $tablehf[
'background-image'][
'gradient'])) {
11977 $g = $this->gradient->parseMozGradient($tablehf[
'background-image'][
'gradient']);
11979 if ($table[
'borders_separate']) {
11980 $px = $x + ($table[
'border_spacing_H'] / 2);
11981 $py = $y + ($table[
'border_spacing_V'] / 2);
11982 $pw = $w - $table[
'border_spacing_H'];
11983 $ph = $h - $table[
'border_spacing_V'];
11990 if ($this->ColActive) {
11991 $this->gradient->Gradient($px, $py, $pw, $ph, $g[
'type'], $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend']);
11993 $this->tableBackgrounds[$level * 9 + 7][] = [
'gradient' =>
true,
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
11996 } elseif ($tablehf[
'background-image'][
'image_id']) {
11997 $n = count($this->patterns) + 1;
11998 if ($table[
'borders_separate']) {
11999 $px = $x + ($table[
'border_spacing_H'] / 2);
12000 $py = $y + ($table[
'border_spacing_V'] / 2);
12001 $pw = $w - $table[
'border_spacing_H'];
12002 $ph = $h - $table[
'border_spacing_V'];
12009 if ($this->ColActive) {
12010 list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($tablehf[
'background-image'][
'orig_w'], $tablehf[
'background-image'][
'orig_h'], $pw, $ph, $tablehf[
'background-image'][
'resize'], $tablehf[
'background-image'][
'x_repeat'], $tablehf[
'background-image'][
'y_repeat']);
12011 $this->patterns[$n] = [
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'pgh' => $this->h,
'image_id' => $tablehf[
'background-image'][
'image_id'],
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $tablehf[
'background-image'][
'x_pos'],
'y_pos' => $tablehf[
'background-image'][
'y_pos'],
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'itype' => $tablehf[
'background-image'][
'itype']];
12012 if ($tablehf[
'background-image'][
'opacity'] > 0 && $tablehf[
'background-image'][
'opacity'] < 1) {
12013 $opac = $this->SetAlpha($tablehf[
'background-image'][
'opacity'],
'Normal',
true);
12017 $this->writer->write(sprintf(
'q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, $px * Mpdf::SCALE, ($this->h - $py) * Mpdf::SCALE, $pw * Mpdf::SCALE, -$ph * Mpdf::SCALE));
12019 $this->tableBackgrounds[$level * 9 + 8][] = [
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'image_id' => $tablehf[
'background-image'][
'image_id'],
'orig_w' => $tablehf[
'background-image'][
'orig_w'],
'orig_h' => $tablehf[
'background-image'][
'orig_h'],
'x_pos' => $tablehf[
'background-image'][
'x_pos'],
'y_pos' => $tablehf[
'background-image'][
'y_pos'],
'x_repeat' => $tablehf[
'background-image'][
'x_repeat'],
'y_repeat' => $tablehf[
'background-image'][
'y_repeat'],
'clippath' =>
'',
'resize' => $tablehf[
'background-image'][
'resize'],
'opacity' => $tablehf[
'background-image'][
'opacity'],
'itype' => $tablehf[
'background-image'][
'itype']];
12026 if ($table[
'borders_separate'] && $paintcell && $border) {
12027 $this->_tableRect($x + ($table[
'border_spacing_H'] / 2) + ($border_details[
'L'][
'w'] / 2), $y + ($table[
'border_spacing_V'] / 2) + ($border_details[
'T'][
'w'] / 2), $w - $table[
'border_spacing_H'] - ($border_details[
'L'][
'w'] / 2) - ($border_details[
'R'][
'w'] / 2), $h - $table[
'border_spacing_V'] - ($border_details[
'T'][
'w'] / 2) - ($border_details[
'B'][
'w'] / 2), $border, $border_details,
false, $table[
'borders_separate']);
12028 } elseif ($paintcell && $border) {
12029 $this->_tableRect($x, $y, $w, $h, $border, $border_details,
true, $table[
'borders_separate']);
12033 if (!empty($textbuffer)) {
12034 if ($horf ==
'F' && preg_match(
'/{colsum([0-9]*)[_]*}/', $textbuffer[0][0], $m)) {
12035 $rep = sprintf(
"%01." . intval($m[1]) .
"f", $this->colsums[$colctr - 1]);
12036 $textbuffer[0][0] = preg_replace(
'/{colsum[0-9_]*}/', $rep, $textbuffer[0][0]);
12040 $cellPtSize = $textbuffer[0][11] / $this->shrin_k;
12041 if (!$cellPtSize) {
12042 $cellPtSize = $this->default_font_size;
12044 $cellFontHeight = ($cellPtSize / Mpdf::SCALE);
12047 $angle = intval($R);
12052 } elseif ($angle > 0 && (isset($va) && $va !=
'B')) {
12054 } elseif ($angle > 0 && $angle < 45) {
12056 } elseif ($angle < 0) {
12060 $offset = ((sin(deg2rad($angle))) * 0.37 * $cellFontHeight);
12061 if (isset($align) && $align ==
'R') {
12062 $this->x += ($w) + ($offset) - ($cellFontHeight / 3) - ($padding[
'R'] + $border_details[
'R'][
'w']);
12063 } elseif (!isset($align) || $align ==
'C') {
12064 $this->x += ($w / 2) + ($offset);
12066 $this->x += ($offset) + ($cellFontHeight / 3) + ($padding[
'L'] + $border_details[
'L'][
'w']);
12069 foreach ($tablehf[
'textbuffer'] as $t) {
12070 $str .= $t[0] .
' ';
12072 $str = rtrim($str);
12074 if (!isset($va) || $va ==
'M') {
12075 $this->y -= ($h - $mih) / 2;
12077 $this->y += (($h - $mih) / 2) + ($padding[
'T'] + $border_details[
'T'][
'w']) + ($mih - ($padding[
'T'] + $border_details[
'T'][
'w'] + $border_details[
'B'][
'w'] + $padding[
'B']));
12078 } elseif ($angle < 0) {
12079 $this->y += (($h - $mih) / 2) + ($padding[
'T'] + $border_details[
'T'][
'w']);
12081 } elseif (isset($va) && $va ==
'B') {
12082 $this->y -= $h - $mih;
12084 $this->y += $h - ($border_details[
'B'][
'w'] + $padding[
'B']);
12085 } elseif ($angle < 0) {
12086 $this->y += $h - $mih + ($padding[
'T'] + $border_details[
'T'][
'w']);
12088 } elseif (isset($va) && $va ==
'T') {
12090 $this->y += $mih - ($border_details[
'B'][
'w'] + $padding[
'B']);
12091 } elseif ($angle < 0) {
12092 $this->y += ($padding[
'T'] + $border_details[
'T'][
'w']);
12096 $this->Rotate($angle, $this->x, $this->y);
12097 $s_fs = $this->FontSizePt;
12098 $s_f = $this->FontFamily;
12099 $s_st = $this->FontStyle;
12100 if (!empty($textbuffer[0][3])) {
12101 $cor = $textbuffer[0][3];
12102 $this->SetTColor($cor);
12104 $this->
SetFont($textbuffer[0][4], $textbuffer[0][2], $cellPtSize,
true,
true);
12106 $this->magic_reverse_dir($str, $this->directionality, $textbuffer[0][18]);
12107 $this->Text($this->x, $this->y, $str, $textbuffer[0][18], $textbuffer[0][8]);
12109 $this->
SetFont($s_f, $s_st, $s_fs,
true,
true);
12110 $this->SetTColor(0);
12114 if ($table[
'borders_separate']) {
12115 $xadj = $border_details[
'L'][
'w'] + $padding[
'L'] + ($table[
'border_spacing_H'] / 2);
12116 $wadj = $border_details[
'L'][
'w'] + $border_details[
'R'][
'w'] + $padding[
'L'] + $padding[
'R'] + $table[
'border_spacing_H'];
12117 $yadj = $border_details[
'T'][
'w'] + $padding[
'T'] + ($table[
'border_spacing_H'] / 2);
12119 $xadj = $border_details[
'L'][
'w'] / 2 + $padding[
'L'];
12120 $wadj = ($border_details[
'L'][
'w'] + $border_details[
'R'][
'w']) / 2 + $padding[
'L'] + $padding[
'R'];
12121 $yadj = $border_details[
'T'][
'w'] / 2 + $padding[
'T'];
12124 $this->divwidth = $w - ($wadj);
12127 $this->printbuffer($textbuffer,
'',
true,
false, $direction);
12133 if (!$this->ColActive) {
12134 if (isset($content[$i][0][
'trgradients']) && ($colctr == 1 || $table[
'borders_separate'])) {
12135 $g = $this->gradient->parseBackgroundGradient($content[$i][0][
'trgradients']);
12140 $gw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
12141 if ($table[
'borders_separate']) {
12142 $gw -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] + $table[
'border_spacing_H']);
12143 $clx = $x + ($table[
'border_spacing_H'] / 2);
12144 $cly = $y + ($table[
'border_spacing_V'] / 2);
12145 $clw = $w - $table[
'border_spacing_H'];
12146 $clh = $h - $table[
'border_spacing_V'];
12148 $s = $this->_setClippingPath($clx, $cly, $clw, $clh);
12149 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx + ($table[
'border_spacing_H'] / 2),
'y' => $gy + ($table[
'border_spacing_V'] / 2),
'w' => $gw - $table[
'border_spacing_V'],
'h' => $gh - $table[
'border_spacing_H'],
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' => $s];
12151 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx,
'y' => $gy,
'w' => $gw,
'h' => $gh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
12156 if (isset($content[$i][0][
'trbackground-images']) && ($colctr == 1 || $table[
'borders_separate'])) {
12157 if ($content[$i][0][
'trbackground-images'][
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $content[$i][0][
'trbackground-images'][
'gradient'])) {
12158 $g = $this->gradient->parseMozGradient($content[$i][0][
'trbackground-images'][
'gradient']);
12163 $gw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
12164 if ($table[
'borders_separate']) {
12165 $gw -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] + $table[
'border_spacing_H']);
12166 $clx = $x + ($table[
'border_spacing_H'] / 2);
12167 $cly = $y + ($table[
'border_spacing_V'] / 2);
12168 $clw = $w - $table[
'border_spacing_H'];
12169 $clh = $h - $table[
'border_spacing_V'];
12171 $s = $this->_setClippingPath($clx, $cly, $clw, $clh);
12172 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx + ($table[
'border_spacing_H'] / 2),
'y' => $gy + ($table[
'border_spacing_V'] / 2),
'w' => $gw - $table[
'border_spacing_V'],
'h' => $gh - $table[
'border_spacing_H'],
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' => $s];
12174 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx,
'y' => $gy,
'w' => $gw,
'h' => $gh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
12178 $image_id = $content[$i][0][
'trbackground-images'][
'image_id'];
12179 $orig_w = $content[$i][0][
'trbackground-images'][
'orig_w'];
12180 $orig_h = $content[$i][0][
'trbackground-images'][
'orig_h'];
12181 $x_pos = $content[$i][0][
'trbackground-images'][
'x_pos'];
12182 $y_pos = $content[$i][0][
'trbackground-images'][
'y_pos'];
12183 $x_repeat = $content[$i][0][
'trbackground-images'][
'x_repeat'];
12184 $y_repeat = $content[$i][0][
'trbackground-images'][
'y_repeat'];
12185 $resize = $content[$i][0][
'trbackground-images'][
'resize'];
12186 $opacity = $content[$i][0][
'trbackground-images'][
'opacity'];
12187 $itype = $content[$i][0][
'trbackground-images'][
'itype'];
12193 $gw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
12194 if ($table[
'borders_separate']) {
12195 $gw -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] + $table[
'border_spacing_H']);
12196 $clx = $x + ($table[
'border_spacing_H'] / 2);
12197 $cly = $y + ($table[
'border_spacing_V'] / 2);
12198 $clw = $w - $table[
'border_spacing_H'];
12199 $clh = $h - $table[
'border_spacing_V'];
12201 $s = $this->_setClippingPath($clx, $cly, $clw, $clh);
12202 $this->tableBackgrounds[$level * 9 + 5][] = [
'x' => $gx + ($table[
'border_spacing_H'] / 2),
'y' => $gy + ($table[
'border_spacing_V'] / 2),
'w' => $gw - $table[
'border_spacing_V'],
'h' => $gh - $table[
'border_spacing_H'],
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' => $s,
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
12204 $this->tableBackgrounds[$level * 9 + 5][] = [
'x' => $gx,
'y' => $gy,
'w' => $gw,
'h' => $gh,
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' =>
'',
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
12212 if (($table[
'borders_separate'] || ($this->simpleTables && !$table[
'simple'][
'border'])) && $table[
'border']) {
12213 $halfspaceL = $table[
'padding'][
'L'] + ($table[
'border_spacing_H'] / 2);
12214 $halfspaceR = $table[
'padding'][
'R'] + ($table[
'border_spacing_H'] / 2);
12215 $halfspaceT = $table[
'padding'][
'T'] + ($table[
'border_spacing_V'] / 2);
12216 $halfspaceB = $table[
'padding'][
'B'] + ($table[
'border_spacing_V'] / 2);
12223 if ($i == $firstrow && $horf ==
'H') {
12224 $tby -= $halfspaceT + ($table[
'border_details'][
'T'][
'w'] / 2);
12225 $tbh += $halfspaceT + ($table[
'border_details'][
'T'][
'w'] / 2);
12229 if (($i == ($lastrow) || (isset($tablehf[
'rowspan']) && ($i + $tablehf[
'rowspan']) == ($lastrow + 1))) && $horf ==
'F') {
12230 $tbh += $halfspaceB + ($table[
'border_details'][
'B'][
'w'] / 2);
12234 if ($colctr == 1 && $firstSpread) {
12235 $tbx -= $halfspaceL + ($table[
'border_details'][
'L'][
'w'] / 2);
12236 $tbw += $halfspaceL + ($table[
'border_details'][
'L'][
'w'] / 2);
12240 if ($colctr == count($content[$i]) && $finalSpread) {
12241 $tbw += $halfspaceR + ($table[
'border_details'][
'R'][
'w'] / 2);
12245 $this->_tableRect($tbx, $tby, $tbw, $tbh, $tab_bord, $table[
'border_details'],
false, $table[
'borders_separate'],
'table', $corner, $table[
'border_spacing_V'], $table[
'border_spacing_H']);
12248 $this->y = $y + $h;
12251 $this->colsums = [];
12261 if (is_array($header) && isset($header[
'html']) && $header[
'html']) {
12262 $Hhtml = $header[
'html'];
12263 if ($this->setAutoTopMargin) {
12264 if (isset($header[
'h'])) {
12265 $height = $header[
'h'];
12267 $height = $this->_getHtmlHeight($Hhtml);
12270 } elseif (!is_array($header) && $header) {
12272 if ($this->setAutoTopMargin) {
12273 $height = $this->_getHtmlHeight($Hhtml);
12285 $this->HTMLHeaderE = [];
12286 $this->HTMLHeaderE[
'html'] = $Hhtml;
12287 $this->HTMLHeaderE[
'h'] = $height;
12289 $this->HTMLHeaderE =
'';
12293 $this->HTMLHeader = [];
12294 $this->HTMLHeader[
'html'] = $Hhtml;
12295 $this->HTMLHeader[
'h'] = $height;
12297 $this->HTMLHeader =
'';
12301 if (!$this->mirrorMargins && $OE ==
'E') {
12304 if ($Hhtml ==
'') {
12308 if ($this->setAutoTopMargin ==
'pad') {
12309 $this->tMargin = $this->margin_header + $height + $this->orig_tMargin;
12310 if (isset($this->saveHTMLHeader[$this->page][$OE][
'mt'])) {
12311 $this->saveHTMLHeader[$this->page][$OE][
'mt'] = $this->tMargin;
12313 } elseif ($this->setAutoTopMargin ==
'stretch') {
12314 $this->tMargin = max($this->orig_tMargin, $this->margin_header + $height + $this->autoMarginPadding);
12315 if (isset($this->saveHTMLHeader[$this->page][$OE][
'mt'])) {
12316 $this->saveHTMLHeader[$this->page][$OE][
'mt'] = $this->tMargin;
12319 if ($write && $this->state != 0 && (($this->mirrorMargins && $OE ==
'E' && ($this->page) % 2 == 0) || ($this->mirrorMargins && $OE !=
'E' && ($this->page) % 2 == 1) || !$this->mirrorMargins)) {
12320 $this->writeHTMLHeaders();
12327 if (is_array($footer) && isset($footer[
'html']) && $footer[
'html']) {
12328 $Fhtml = $footer[
'html'];
12329 if ($this->setAutoBottomMargin) {
12330 if (isset($footer[
'h'])) {
12331 $height = $footer[
'h'];
12333 $height = $this->_getHtmlHeight($Fhtml);
12336 } elseif (!is_array($footer) && $footer) {
12338 if ($this->setAutoBottomMargin) {
12339 $height = $this->_getHtmlHeight($Fhtml);
12351 $this->HTMLFooterE = [];
12352 $this->HTMLFooterE[
'html'] = $Fhtml;
12353 $this->HTMLFooterE[
'h'] = $height;
12355 $this->HTMLFooterE =
'';
12359 $this->HTMLFooter = [];
12360 $this->HTMLFooter[
'html'] = $Fhtml;
12361 $this->HTMLFooter[
'h'] = $height;
12363 $this->HTMLFooter =
'';
12367 if (!$this->mirrorMargins && $OE ==
'E') {
12371 if ($Fhtml ==
'') {
12375 if ($this->setAutoBottomMargin ==
'pad') {
12376 $this->bMargin = $this->margin_footer + $height + $this->orig_bMargin;
12377 $this->PageBreakTrigger = $this->h - $this->bMargin;
12378 if (isset($this->saveHTMLHeader[$this->page][$OE][
'mb'])) {
12379 $this->saveHTMLHeader[$this->page][$OE][
'mb'] = $this->bMargin;
12381 } elseif ($this->setAutoBottomMargin ==
'stretch') {
12382 $this->bMargin = max($this->orig_bMargin, $this->margin_footer + $height + $this->autoMarginPadding);
12383 $this->PageBreakTrigger = $this->h - $this->bMargin;
12384 if (isset($this->saveHTMLHeader[$this->page][$OE][
'mb'])) {
12385 $this->saveHTMLHeader[$this->page][$OE][
'mb'] = $this->bMargin;
12392 $save_state = $this->state;
12393 if ($this->state == 0) {
12394 $this->
AddPage($this->CurOrientation);
12398 $this->pageoutput[$this->page] = [];
12399 $save_x = $this->x;
12400 $save_y = $this->y;
12401 $this->x = $this->lMargin;
12402 $this->y = $this->margin_header;
12405 $pnstr = $this->pagenumPrefix . $this->docPageNum($this->page) . $this->pagenumSuffix;
12406 $pntstr = $this->nbpgPrefix . $this->docPageNumTotal($this->page) . $this->nbpgSuffix;
12408 $html = $this->aliasReplace(
$html, $pnstr, $pntstr, $nb);
12410 $this->HTMLheaderPageLinks = [];
12411 $this->HTMLheaderPageAnnots = [];
12412 $this->HTMLheaderPageForms = [];
12413 $savepb = $this->pageBackgrounds;
12414 $this->writingHTMLheader =
true;
12416 $this->writingHTMLheader =
false;
12417 $h = ($this->y - $this->margin_header);
12421 $this->blk[0][
'blockContext'] = 0;
12422 $this->blk[0][
'float_endpos'] = 0;
12424 $this->pageoutput[$this->page] = [];
12425 $this->headerbuffer =
'';
12426 $this->pageBackgrounds = $savepb;
12427 $this->x = $save_x;
12428 $this->y = $save_y;
12429 $this->state = $save_state;
12431 if ($save_state == 0) {
12432 unset($this->pages[1]);
12442 if ($this->mirrorMargins && ($this->page) % 2 == 0) {
12449 $this->saveHTMLHeader[$this->page][$OE][
'html'] = $this->HTMLHeaderE[
'html'];
12451 $this->saveHTMLHeader[$this->page][$OE][
'html'] = $this->HTMLHeader[
'html'];
12454 if ($this->forcePortraitHeaders && $this->CurOrientation ==
'L' && $this->CurOrientation != $this->DefOrientation) {
12455 $this->saveHTMLHeader[$this->page][$OE][
'rotate'] =
true;
12456 $this->saveHTMLHeader[$this->page][$OE][
'ml'] = $this->tMargin;
12457 $this->saveHTMLHeader[$this->page][$OE][
'mr'] = $this->bMargin;
12458 $this->saveHTMLHeader[$this->page][$OE][
'mh'] = $this->margin_header;
12459 $this->saveHTMLHeader[$this->page][$OE][
'mf'] = $this->margin_footer;
12460 $this->saveHTMLHeader[$this->page][$OE][
'pw'] = $this->h;
12461 $this->saveHTMLHeader[$this->page][$OE][
'ph'] = $this->w;
12463 $this->saveHTMLHeader[$this->page][$OE][
'ml'] = $this->lMargin;
12464 $this->saveHTMLHeader[$this->page][$OE][
'mr'] = $this->rMargin;
12465 $this->saveHTMLHeader[$this->page][$OE][
'mh'] = $this->margin_header;
12466 $this->saveHTMLHeader[$this->page][$OE][
'mf'] = $this->margin_footer;
12467 $this->saveHTMLHeader[$this->page][$OE][
'pw'] = $this->w;
12468 $this->saveHTMLHeader[$this->page][$OE][
'ph'] = $this->h;
12475 if ($this->mirrorMargins && ($this->page) % 2 == 0) {
12482 $this->saveHTMLFooter[$this->page][$OE][
'html'] = $this->HTMLFooterE[
'html'];
12484 $this->saveHTMLFooter[$this->page][$OE][
'html'] = $this->HTMLFooter[
'html'];
12487 if ($this->forcePortraitHeaders && $this->CurOrientation ==
'L' && $this->CurOrientation != $this->DefOrientation) {
12488 $this->saveHTMLFooter[$this->page][$OE][
'rotate'] =
true;
12489 $this->saveHTMLFooter[$this->page][$OE][
'ml'] = $this->tMargin;
12490 $this->saveHTMLFooter[$this->page][$OE][
'mr'] = $this->bMargin;
12491 $this->saveHTMLFooter[$this->page][$OE][
'mt'] = $this->rMargin;
12492 $this->saveHTMLFooter[$this->page][$OE][
'mb'] = $this->lMargin;
12493 $this->saveHTMLFooter[$this->page][$OE][
'mh'] = $this->margin_header;
12494 $this->saveHTMLFooter[$this->page][$OE][
'mf'] = $this->margin_footer;
12495 $this->saveHTMLFooter[$this->page][$OE][
'pw'] = $this->h;
12496 $this->saveHTMLFooter[$this->page][$OE][
'ph'] = $this->w;
12498 $this->saveHTMLFooter[$this->page][$OE][
'ml'] = $this->lMargin;
12499 $this->saveHTMLFooter[$this->page][$OE][
'mr'] = $this->rMargin;
12500 $this->saveHTMLFooter[$this->page][$OE][
'mt'] = $this->tMargin;
12501 $this->saveHTMLFooter[$this->page][$OE][
'mb'] = $this->bMargin;
12502 $this->saveHTMLFooter[$this->page][$OE][
'mh'] = $this->margin_header;
12503 $this->saveHTMLFooter[$this->page][$OE][
'mf'] = $this->margin_footer;
12504 $this->saveHTMLFooter[$this->page][$OE][
'pw'] = $this->w;
12505 $this->saveHTMLFooter[$this->page][$OE][
'ph'] = $this->h;
12513 $l = mb_strlen($cl,
'UTF-8');
12514 $c = mb_strlen($cc,
'UTF-8');
12515 $r = mb_strlen($cr,
'UTF-8');
12519 return [intval($s * 100 / $tw), intval($c * 100 / $tw), intval($s * 100 / $tw)];
12521 return [33, 33, 33];
12529 $lContent = (isset($arr[
'L'][
'content']) ? $arr[
'L'][
'content'] :
'');
12530 $cContent = (isset($arr[
'C'][
'content']) ? $arr[
'C'][
'content'] :
'');
12531 $rContent = (isset($arr[
'R'][
'content']) ? $arr[
'R'][
'content'] :
'');
12533 list($lw,
$cw, $rw) = $this->_shareHeaderFooterWidth($lContent, $cContent, $rContent);
12536 $valign =
'bottom';
12537 $vpadding =
'0 0 ' . $this->header_line_spacing .
'em 0';
12540 $vpadding =
'' . $this->footer_line_spacing .
'em 0 0 0';
12543 if ($this->directionality ==
'rtl') {
12544 $talignL =
'right';
12548 $talignR =
'right';
12551 $html =
'<table width="100%" style="border-collapse: collapse; margin: 0; vertical-align: ' . $valign .
'; color: #000000; ';
12553 if (isset($arr[
'line']) && $arr[
'line']) {
12554 $html .=
' border-' . $valign .
': 0.1mm solid #000000;';
12559 $html .=
'<td width="' . $lw .
'%" style="padding: ' . $vpadding .
'; text-align: ' . $talignL .
'; ';
12561 if (isset($arr[
'L'][
'font-family'])) {
12562 $html .=
' font-family: ' . $arr[
'L'][
'font-family'] .
';';
12565 if (isset($arr[
'L'][
'color'])) {
12566 $html .=
' color: ' . $arr[
'L'][
'color'] .
';';
12569 if (isset($arr[
'L'][
'font-size'])) {
12570 $html .=
' font-size: ' . $arr[
'L'][
'font-size'] .
'pt;';
12573 if (isset($arr[
'L'][
'font-style'])) {
12574 if ($arr[
'L'][
'font-style'] ==
'B' || $arr[
'L'][
'font-style'] ==
'BI') {
12575 $html .=
' font-weight: bold;';
12577 if ($arr[
'L'][
'font-style'] ==
'I' || $arr[
'L'][
'font-style'] ==
'BI') {
12578 $html .=
' font-style: italic;';
12582 $html .=
'">' . $lContent .
'</td>';
12583 $html .=
'<td width="' .
$cw .
'%" style="padding: ' . $vpadding .
'; text-align: center; ';
12585 if (isset($arr[
'C'][
'font-family'])) {
12586 $html .=
' font-family: ' . $arr[
'C'][
'font-family'] .
';';
12589 if (isset($arr[
'C'][
'color'])) {
12590 $html .=
' color: ' . $arr[
'C'][
'color'] .
';';
12593 if (isset($arr[
'C'][
'font-size'])) {
12594 $html .=
' font-size: ' . $arr[
'C'][
'font-size'] .
'pt;';
12597 if (isset($arr[
'C'][
'font-style'])) {
12598 if ($arr[
'C'][
'font-style'] ==
'B' || $arr[
'C'][
'font-style'] ==
'BI') {
12599 $html .=
' font-weight: bold;';
12601 if ($arr[
'C'][
'font-style'] ==
'I' || $arr[
'C'][
'font-style'] ==
'BI') {
12602 $html .=
' font-style: italic;';
12606 $html .=
'">' . $cContent .
'</td>';
12607 $html .=
'<td width="' . $rw .
'%" style="padding: ' . $vpadding .
'; text-align: ' . $talignR .
'; ';
12609 if (isset($arr[
'R'][
'font-family'])) {
12610 $html .=
' font-family: ' . $arr[
'R'][
'font-family'] .
';';
12613 if (isset($arr[
'R'][
'color'])) {
12614 $html .=
' color: ' . $arr[
'R'][
'color'] .
';';
12617 if (isset($arr[
'R'][
'font-size'])) {
12618 $html .=
' font-size: ' . $arr[
'R'][
'font-size'] .
'pt;';
12621 if (isset($arr[
'R'][
'font-style'])) {
12622 if ($arr[
'R'][
'font-style'] ==
'B' || $arr[
'R'][
'font-style'] ==
'BI') {
12623 $html .=
' font-weight: bold;';
12625 if ($arr[
'R'][
'font-style'] ==
'I' || $arr[
'R'][
'font-style'] ==
'BI') {
12626 $html .=
' font-style: italic;';
12630 $html .=
'">' . $rContent .
'</td>';
12631 $html .=
'</tr></table>';
12639 $name =
'_nonhtmldefault';
12641 $html = $this->_createHTMLheaderFooter($arr,
'H');
12643 $this->pageHTMLheaders[
$name][
'html'] =
$html;
12644 $this->pageHTMLheaders[
$name][
'h'] = $this->_getHtmlHeight(
$html);
12650 $name =
'_nonhtmldefault';
12652 $html = $this->_createHTMLheaderFooter($arr,
'F');
12654 $this->pageHTMLfooters[
$name][
'html'] =
$html;
12655 $this->pageHTMLfooters[
$name][
'h'] = $this->_getHtmlHeight(
$html);
12661 $name =
'_nonhtmldefault';
12663 $this->SetHTMLHeader($this->pageHTMLheaders[
$name], $side, $write);
12669 $name =
'_nonhtmldefault';
12671 $this->SetHTMLFooter($this->pageHTMLfooters[
$name], $side);
12677 $name =
'_default';
12680 $this->pageHTMLheaders[
$name][
'html'] =
$html;
12681 $this->pageHTMLheaders[
$name][
'h'] = $this->_getHtmlHeight(
$html);
12687 $name =
'_default';
12690 $this->pageHTMLfooters[
$name][
'html'] =
$html;
12691 $this->pageHTMLfooters[
$name][
'h'] = $this->_getHtmlHeight(
$html);
12697 $name =
'_default';
12699 $this->SetHTMLHeader($this->pageHTMLheaders[
$name], $side, $write);
12705 $name =
'_default';
12707 $this->SetHTMLFooter($this->pageHTMLfooters[
$name], $side);
12715 if (is_string($Harray)) {
12717 if (strlen($Harray) === 0) {
12722 } elseif (strpos($Harray,
'|') !==
false) {
12724 $hdet = explode(
'|', $Harray);
12726 list($lw,
$cw, $rw) = $this->_shareHeaderFooterWidth($hdet[0], $hdet[1], $hdet[2]);
12727 $oddhtml =
'<table width="100%" style="border-collapse: collapse; margin: 0; vertical-align: bottom; color: #000000; ';
12729 if ($this->defaultheaderfontsize) {
12730 $oddhtml .=
' font-size: ' . $this->defaultheaderfontsize .
'pt;';
12733 if ($this->defaultheaderfontstyle) {
12735 if ($this->defaultheaderfontstyle ==
'B' || $this->defaultheaderfontstyle ==
'BI') {
12736 $oddhtml .=
' font-weight: bold;';
12739 if ($this->defaultheaderfontstyle ==
'I' || $this->defaultheaderfontstyle ==
'BI') {
12740 $oddhtml .=
' font-style: italic;';
12744 if ($this->defaultheaderline) {
12745 $oddhtml .=
' border-bottom: 0.1mm solid #000000;';
12749 $oddhtml .=
'<tr>';
12750 $oddhtml .=
'<td width="' . $lw .
'%" style="padding: 0 0 ' . $this->header_line_spacing .
'em 0; text-align: left; ">' . $hdet[0] .
'</td>';
12751 $oddhtml .=
'<td width="' .
$cw .
'%" style="padding: 0 0 ' . $this->header_line_spacing .
'em 0; text-align: center; ">' . $hdet[1] .
'</td>';
12752 $oddhtml .=
'<td width="' . $rw .
'%" style="padding: 0 0 ' . $this->header_line_spacing .
'em 0; text-align: right; ">' . $hdet[2] .
'</td>';
12753 $oddhtml .=
'</tr></table>';
12755 $evenhtml =
'<table width="100%" style="border-collapse: collapse; margin: 0; vertical-align: bottom; color: #000000; ';
12757 if ($this->defaultheaderfontsize) {
12758 $evenhtml .=
' font-size: ' . $this->defaultheaderfontsize .
'pt;';
12761 if ($this->defaultheaderfontstyle) {
12762 if ($this->defaultheaderfontstyle ==
'B' || $this->defaultheaderfontstyle ==
'BI') {
12763 $evenhtml .=
' font-weight: bold;';
12765 if ($this->defaultheaderfontstyle ==
'I' || $this->defaultheaderfontstyle ==
'BI') {
12766 $evenhtml .=
' font-style: italic;';
12770 if ($this->defaultheaderline) {
12771 $evenhtml .=
' border-bottom: 0.1mm solid #000000;';
12775 $evenhtml .=
'<tr>';
12776 $evenhtml .=
'<td width="' . $rw .
'%" style="padding: 0 0 ' . $this->header_line_spacing .
'em 0; text-align: left; ">' . $hdet[2] .
'</td>';
12777 $evenhtml .=
'<td width="' .
$cw .
'%" style="padding: 0 0 ' . $this->header_line_spacing .
'em 0; text-align: center; ">' . $hdet[1] .
'</td>';
12778 $evenhtml .=
'<td width="' . $lw .
'%" style="padding: 0 0 ' . $this->header_line_spacing .
'em 0; text-align: right; ">' . $hdet[0] .
'</td>';
12779 $evenhtml .=
'</tr></table>';
12783 $oddhtml =
'<div style="margin: 0; color: #000000; ';
12785 if ($this->defaultheaderfontsize) {
12786 $oddhtml .=
' font-size: ' . $this->defaultheaderfontsize .
'pt;';
12789 if ($this->defaultheaderfontstyle) {
12791 if ($this->defaultheaderfontstyle ==
'B' || $this->defaultheaderfontstyle ==
'BI') {
12792 $oddhtml .=
' font-weight: bold;';
12795 if ($this->defaultheaderfontstyle ==
'I' || $this->defaultheaderfontstyle ==
'BI') {
12796 $oddhtml .=
' font-style: italic;';
12800 if ($this->defaultheaderline) {
12801 $oddhtml .=
' border-bottom: 0.1mm solid #000000;';
12804 $oddhtml .=
'text-align: right; ">' . $Harray .
'</div>';
12805 $evenhtml =
'<div style="margin: 0; color: #000000; ';
12807 if ($this->defaultheaderfontsize) {
12808 $evenhtml .=
' font-size: ' . $this->defaultheaderfontsize .
'pt;';
12811 if ($this->defaultheaderfontstyle) {
12813 if ($this->defaultheaderfontstyle ==
'B' || $this->defaultheaderfontstyle ==
'BI') {
12814 $evenhtml .=
' font-weight: bold;';
12817 if ($this->defaultheaderfontstyle ==
'I' || $this->defaultheaderfontstyle ==
'BI') {
12818 $evenhtml .=
' font-style: italic;';
12822 if ($this->defaultheaderline) {
12823 $evenhtml .=
' border-bottom: 0.1mm solid #000000;';
12826 $evenhtml .=
'text-align: left; ">' . $Harray .
'</div>';
12829 } elseif (is_array($Harray) && !empty($Harray)) {
12834 if ($side ===
'O') {
12836 } elseif ($side ===
'E') {
12843 $oddhtml = $this->_createHTMLheaderFooter($odd,
'H');
12844 $evenhtml = $this->_createHTMLheaderFooter($even,
'H');
12847 if ($side ===
'E') {
12848 $this->SetHTMLHeader($evenhtml,
'E', $write);
12849 } elseif ($side ===
'O') {
12850 $this->SetHTMLHeader($oddhtml,
'O', $write);
12852 $this->SetHTMLHeader($oddhtml,
'O', $write);
12853 $this->SetHTMLHeader($evenhtml,
'E', $write);
12862 if (is_string($Farray)) {
12864 if (strlen($Farray) == 0) {
12869 } elseif (strpos($Farray,
'|') !==
false) {
12871 $hdet = explode(
'|', $Farray);
12872 $oddhtml =
'<table width="100%" style="border-collapse: collapse; margin: 0; vertical-align: top; color: #000000; ';
12874 if ($this->defaultfooterfontsize) {
12875 $oddhtml .=
' font-size: ' . $this->defaultfooterfontsize .
'pt;';
12878 if ($this->defaultfooterfontstyle) {
12879 if ($this->defaultfooterfontstyle ==
'B' || $this->defaultfooterfontstyle ==
'BI') {
12880 $oddhtml .=
' font-weight: bold;';
12882 if ($this->defaultfooterfontstyle ==
'I' || $this->defaultfooterfontstyle ==
'BI') {
12883 $oddhtml .=
' font-style: italic;';
12887 if ($this->defaultfooterline) {
12888 $oddhtml .=
' border-top: 0.1mm solid #000000;';
12892 $oddhtml .=
'<tr>';
12893 $oddhtml .=
'<td width="33%" style="padding: ' . $this->footer_line_spacing .
'em 0 0 0; text-align: left; ">' . $hdet[0] .
'</td>';
12894 $oddhtml .=
'<td width="33%" style="padding: ' . $this->footer_line_spacing .
'em 0 0 0; text-align: center; ">' . $hdet[1] .
'</td>';
12895 $oddhtml .=
'<td width="33%" style="padding: ' . $this->footer_line_spacing .
'em 0 0 0; text-align: right; ">' . $hdet[2] .
'</td>';
12896 $oddhtml .=
'</tr></table>';
12898 $evenhtml =
'<table width="100%" style="border-collapse: collapse; margin: 0; vertical-align: top; color: #000000; ';
12900 if ($this->defaultfooterfontsize) {
12901 $evenhtml .=
' font-size: ' . $this->defaultfooterfontsize .
'pt;';
12904 if ($this->defaultfooterfontstyle) {
12906 if ($this->defaultfooterfontstyle ==
'B' || $this->defaultfooterfontstyle ==
'BI') {
12907 $evenhtml .=
' font-weight: bold;';
12910 if ($this->defaultfooterfontstyle ==
'I' || $this->defaultfooterfontstyle ==
'BI') {
12911 $evenhtml .=
' font-style: italic;';
12915 if ($this->defaultfooterline) {
12916 $evenhtml .=
' border-top: 0.1mm solid #000000;';
12920 $evenhtml .=
'<tr>';
12921 $evenhtml .=
'<td width="33%" style="padding: ' . $this->footer_line_spacing .
'em 0 0 0; text-align: left; ">' . $hdet[2] .
'</td>';
12922 $evenhtml .=
'<td width="33%" style="padding: ' . $this->footer_line_spacing .
'em 0 0 0; text-align: center; ">' . $hdet[1] .
'</td>';
12923 $evenhtml .=
'<td width="33%" style="padding: ' . $this->footer_line_spacing .
'em 0 0 0; text-align: right; ">' . $hdet[0] .
'</td>';
12924 $evenhtml .=
'</tr></table>';
12928 $oddhtml =
'<div style="margin: 0; color: #000000; ';
12930 if ($this->defaultfooterfontsize) {
12931 $oddhtml .=
' font-size: ' . $this->defaultfooterfontsize .
'pt;';
12934 if ($this->defaultfooterfontstyle) {
12936 if ($this->defaultfooterfontstyle ==
'B' || $this->defaultfooterfontstyle ==
'BI') {
12937 $oddhtml .=
' font-weight: bold;';
12940 if ($this->defaultfooterfontstyle ==
'I' || $this->defaultfooterfontstyle ==
'BI') {
12941 $oddhtml .=
' font-style: italic;';
12945 if ($this->defaultfooterline) {
12946 $oddhtml .=
' border-top: 0.1mm solid #000000;';
12949 $oddhtml .=
'text-align: right; ">' . $Farray .
'</div>';
12951 $evenhtml =
'<div style="margin: 0; color: #000000; ';
12953 if ($this->defaultfooterfontsize) {
12954 $evenhtml .=
' font-size: ' . $this->defaultfooterfontsize .
'pt;';
12957 if ($this->defaultfooterfontstyle) {
12959 if ($this->defaultfooterfontstyle ==
'B' || $this->defaultfooterfontstyle ==
'BI') {
12960 $evenhtml .=
' font-weight: bold;';
12963 if ($this->defaultfooterfontstyle ==
'I' || $this->defaultfooterfontstyle ==
'BI') {
12964 $evenhtml .=
' font-style: italic;';
12968 if ($this->defaultfooterline) {
12969 $evenhtml .=
' border-top: 0.1mm solid #000000;';
12972 $evenhtml .=
'text-align: left; ">' . $Farray .
'</div>';
12975 } elseif (is_array($Farray)) {
12980 if ($side ===
'O') {
12982 } elseif ($side ==
'E') {
12989 $oddhtml = $this->_createHTMLheaderFooter($odd,
'F');
12990 $evenhtml = $this->_createHTMLheaderFooter($even,
'F');
12993 if ($side ===
'E') {
12994 $this->SetHTMLFooter($evenhtml,
'E');
12995 } elseif ($side ===
'O') {
12996 $this->SetHTMLFooter($oddhtml,
'O');
12998 $this->SetHTMLFooter($oddhtml,
'O');
12999 $this->SetHTMLFooter($evenhtml,
'E');
13008 $this->watermarkTextAlpha = $alpha;
13010 $this->watermarkText = $txt;
13016 $this->watermarkImageAlpha = $alpha;
13018 $this->watermarkImage = $src;
13019 $this->watermark_size = $size;
13020 $this->watermark_pos = $pos;
13030 if ($this->show_marks ==
'CROP' || $this->show_marks ==
'CROPCROSS') {
13033 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
13034 $l = $this->cropMarkLength;
13035 $m = $this->cropMarkMargin;
13036 $b = $this->nonPrintMargin;
13038 $bx = $this->page_box[
'outer_width_LR'] - $m;
13039 $ax = max($ax1, $bx - $l);
13040 $cx1 = $this->w - $b;
13041 $dx = $this->w - $this->page_box[
'outer_width_LR'] + $m;
13042 $cx = min($cx1, $dx + $l);
13044 $by = $this->page_box[
'outer_width_TB'] - $m;
13045 $ay = max($ay1, $by - $l);
13046 $cy1 = $this->h - $b;
13047 $dy = $this->h - $this->page_box[
'outer_width_TB'] + $m;
13048 $cy = min($cy1, $dy + $l);
13050 $this->Line($ax, $this->page_box[
'outer_width_TB'], $bx, $this->page_box[
'outer_width_TB']);
13051 $this->Line($cx, $this->page_box[
'outer_width_TB'], $dx, $this->page_box[
'outer_width_TB']);
13052 $this->Line($ax, $this->h - $this->page_box[
'outer_width_TB'], $bx, $this->h - $this->page_box[
'outer_width_TB']);
13053 $this->Line($cx, $this->h - $this->page_box[
'outer_width_TB'], $dx, $this->h - $this->page_box[
'outer_width_TB']);
13054 $this->Line($this->page_box[
'outer_width_LR'], $ay, $this->page_box[
'outer_width_LR'], $by);
13055 $this->Line($this->page_box[
'outer_width_LR'], $cy, $this->page_box[
'outer_width_LR'], $dy);
13056 $this->Line($this->w - $this->page_box[
'outer_width_LR'], $ay, $this->w - $this->page_box[
'outer_width_LR'], $by);
13057 $this->Line($this->w - $this->page_box[
'outer_width_LR'], $cy, $this->w - $this->page_box[
'outer_width_LR'], $dy);
13059 if ($this->printers_info) {
13060 $hd = date(
'Y-m-d H:i') .
' Page ' . $this->page .
' of {nb}';
13061 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
13062 $this->
SetFont(
'arial',
'', 7.5,
true,
true);
13063 $this->x = $this->page_box[
'outer_width_LR'] + 1.5;
13065 $this->Cell(0, $this->FontSize, $hd, 0, 0,
'L', 0,
'', 0, 0, 0,
'M');
13066 $this->
SetFont($this->default_font,
'', $this->original_default_font_size);
13069 if ($this->show_marks ==
'CROSS' || $this->show_marks ==
'CROPCROSS') {
13071 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
13075 $m = $this->crossMarkMargin;
13076 $x1 = $this->page_box[
'outer_width_LR'] - $m;
13077 $x2 = $this->w - $this->page_box[
'outer_width_LR'] + $m;
13078 $y1 = $this->page_box[
'outer_width_TB'] - $m;
13079 $y2 = $this->h - $this->page_box[
'outer_width_TB'] + $m;
13081 $this->Circle($x1, $this->h / 2, $r,
'S');
13082 $this->Line($x1 - $w, $this->h / 2, $x1 + $w, $this->h / 2);
13083 $this->Line($x1, $this->h / 2 - $l, $x1, $this->h / 2 + $l);
13085 $this->Circle($x2, $this->h / 2, $r,
'S');
13086 $this->Line($x2 - $w, $this->h / 2, $x2 + $w, $this->h / 2);
13087 $this->Line($x2, $this->h / 2 - $l, $x2, $this->h / 2 + $l);
13089 $this->Circle($this->w / 2, $y1, $r,
'S');
13090 $this->Line($this->w / 2, $y1 - $w, $this->w / 2, $y1 + $w);
13091 $this->Line($this->w / 2 - $l, $y1, $this->w / 2 + $l, $y1);
13093 $this->Circle($this->w / 2, $y2, $r,
'S');
13094 $this->Line($this->w / 2, $y2 - $w, $this->w / 2, $y2 + $w);
13095 $this->Line($this->w / 2 - $l, $y2, $this->w / 2 + $l, $y2);
13102 if ($this->page == 1) {
13103 if ($this->firstPageBoxHeader) {
13104 if (isset($this->pageHTMLheaders[$this->firstPageBoxHeader])) {
13105 $this->HTMLHeader = $this->pageHTMLheaders[$this->firstPageBoxHeader];
13109 if ($this->firstPageBoxFooter) {
13110 if (isset($this->pageHTMLfooters[$this->firstPageBoxFooter])) {
13111 $this->HTMLFooter = $this->pageHTMLfooters[$this->firstPageBoxFooter];
13114 $this->firstPageBoxHeader =
'';
13115 $this->firstPageBoxFooter =
'';
13119 if (($this->mirrorMargins && ($this->page % 2 == 0) && $this->HTMLFooterE) || ($this->mirrorMargins && ($this->page % 2 == 1) && $this->HTMLFooter) || (!$this->mirrorMargins && $this->HTMLFooter)) {
13120 $this->writeHTMLFooters();
13124 if (($this->watermarkText) && ($this->showWatermarkText)) {
13125 $this->watermark($this->watermarkText, $this->watermarkAngle, 120, $this->watermarkTextAlpha);
13127 if (($this->watermarkImage) && ($this->showWatermarkImage)) {
13128 $this->watermarkImg($this->watermarkImage, $this->watermarkImageAlpha);
13148 if (is_scalar(
$html) ===
false) {
13149 if (!is_object(
$html) || ! method_exists(
$html,
'__toString')) {
13150 throw new \Mpdf\MpdfException(
'WriteHTML() requires $html be an integer, float, string, boolean or an object with the __toString() magic method.');
13156 throw new \Mpdf\MpdfException(
'WriteHTML() requires $mode to be one of the modes defined in HTMLParserMode');
13165 $this->headerbuffer =
'';
13166 $this->textbuffer = [];
13167 $this->fixedPosBlockSave = [];
13173 if ($this->allow_charset_conversion) {
13175 $this->ReadCharset(
$html);
13178 $success = iconv($this->charset_in,
'UTF-8//TRANSLIT',
$html);
13188 $this->lastblocklevelchange = 0;
13190 $this->initialiseBlock($this->blk[0]);
13191 $this->blk[0][
'width'] = & $this->pgwidth;
13192 $this->blk[0][
'inner_width'] = & $this->pgwidth;
13193 $this->blk[0][
'blockContext'] = $this->blockContext;
13198 $this->ReadMetaTags(
$html);
13200 if (preg_match(
'/<base[^>]*href=["\']([^"\'>]*)["\']/i',
$html, $m)) {
13201 $this->SetBasePath($m[1]);
13205 if ($this->autoLangToFont && !$this->usingCoreFont && preg_match(
'/<html [^>]*lang=[\'\"](.*?)[\'\"]/ism',
$html, $m)) {
13206 $html_lang = $m[1];
13209 if (preg_match(
'/<html [^>]*dir=[\'\"]\s*rtl\s*[\'\"]/ism',
$html)) {
13210 $zproperties[
'DIRECTION'] =
'rtl';
13214 if (preg_match(
'/<body([^>]*)>(.*?)<\/body>/ism',
$html, $m) || preg_match(
'/<body([^>]*)>(.*)$/ism',
$html, $m)) {
13217 if (preg_match(
'/style=[\"](.*?)[\"]/ism', $m[1], $mm) || preg_match(
'/style=[\'](.*?)[\']/ism', $m[1], $mm)) {
13218 $zproperties = $this->cssManager->readInlineCSS($mm[1]);
13220 if (preg_match(
'/dir=[\'\"]\s*rtl\s*[\'\"]/ism', $m[1])) {
13221 $zproperties[
'DIRECTION'] =
'rtl';
13223 if (isset($html_lang) && $html_lang) {
13224 $zproperties[
'LANG'] = $html_lang;
13226 if ($this->autoLangToFont && !$this->onlyCoreFonts && preg_match(
'/lang=[\'\"](.*?)[\'\"]/ism', $m[1], $mm)) {
13227 $zproperties[
'LANG'] = $mm[1];
13231 $properties = $this->cssManager->MergeCSS(
'BLOCK',
'BODY',
'');
13232 if ($zproperties) {
13233 $properties = $this->cssManager->array_merge_recursive_unique($properties, $zproperties);
13236 if (isset($properties[
'DIRECTION']) && $properties[
'DIRECTION']) {
13237 $this->cssManager->CSS[
'BODY'][
'DIRECTION'] = $properties[
'DIRECTION'];
13239 if (!isset($this->cssManager->CSS[
'BODY'][
'DIRECTION'])) {
13240 $this->cssManager->CSS[
'BODY'][
'DIRECTION'] = $this->directionality;
13242 $this->SetDirectionality($this->cssManager->CSS[
'BODY'][
'DIRECTION']);
13245 $this->setCSS($properties,
'',
'BODY');
13247 $this->blk[0][
'InlineProperties'] = $this->saveInlineProperties();
13252 if (!isset($this->cssManager->CSS[
'BODY'])) {
13253 $this->cssManager->CSS[
'BODY'] = [];
13257 if (isset($properties[
'BACKGROUND-GRADIENT'])) {
13258 $this->bodyBackgroundGradient = $properties[
'BACKGROUND-GRADIENT'];
13261 if (isset($properties[
'BACKGROUND-IMAGE']) && $properties[
'BACKGROUND-IMAGE']) {
13262 $ret = $this->SetBackground($properties, $this->pgwidth);
13264 $this->bodyBackgroundImage = $ret;
13271 if ($this->state == 0 && ((isset($this->cssManager->CSS[
'@PAGE']) && $this->cssManager->CSS[
'@PAGE']) || (isset($this->cssManager->CSS[
'@PAGE>>PSEUDO>>FIRST']) && $this->cssManager->CSS[
'@PAGE>>PSEUDO>>FIRST']))) {
13272 $this->page_box[
'current'] =
'';
13273 $this->page_box[
'using'] =
true;
13274 list($pborientation, $pbmgl, $pbmgr, $pbmgt, $pbmgb, $pbmgh, $pbmgf, $hname, $fname, $bg, $resetpagenum, $pagenumstyle, $suppress, $marks, $newformat) = $this->SetPagedMediaCSS(
'',
false,
'O');
13275 $this->DefOrientation = $this->CurOrientation = $pborientation;
13276 $this->orig_lMargin = $this->DeflMargin = $pbmgl;
13277 $this->orig_rMargin = $this->DefrMargin = $pbmgr;
13278 $this->orig_tMargin = $this->tMargin = $pbmgt;
13279 $this->orig_bMargin = $this->bMargin = $pbmgb;
13280 $this->orig_hMargin = $this->margin_header = $pbmgh;
13281 $this->orig_fMargin = $this->margin_footer = $pbmgf;
13282 list($pborientation, $pbmgl, $pbmgr, $pbmgt, $pbmgb, $pbmgh, $pbmgf, $hname, $fname, $bg, $resetpagenum, $pagenumstyle, $suppress, $marks, $newformat) = $this->SetPagedMediaCSS(
'',
true,
'O');
13283 $this->show_marks = $marks;
13285 $this->firstPageBoxHeader = $hname;
13288 $this->firstPageBoxFooter = $fname;
13293 $parseonly =
false;
13294 $this->bufferoutput =
false;
13300 for ($b = $this->blklvl; $b > 0; $b--) {
13301 $this->tag->CloseTag($this->blk[$b][
'tag'], $arr, $ai);
13304 if (count($this->textbuffer)) {
13305 $this->printbuffer($this->textbuffer);
13307 $this->textbuffer = [];
13312 for ($b = $this->blklvl; $b > 0; $b--) {
13313 $this->tag->CloseTag($this->blk[$b][
'tag'], $arr, $ai);
13316 if (count($this->textbuffer)) {
13317 $this->printbuffer($this->textbuffer);
13319 $this->bufferoutput =
true;
13320 $this->textbuffer = [];
13321 $this->headerbuffer =
'';
13322 $properties = $this->cssManager->MergeCSS(
'BLOCK',
'BODY',
'');
13323 $this->setCSS($properties,
'',
'BODY');
13326 mb_internal_encoding(
'UTF-8');
13328 $html = $this->AdjustHTML(
$html, $this->tabSpaces);
13330 if ($this->autoScriptToLang) {
13334 preg_match_all(
'/<htmlpageheader([^>]*)>(.*?)<\/htmlpageheader>/si',
$html, $h);
13335 for ($i = 0; $i < count($h[1]); $i++) {
13336 if (preg_match(
'/name=[\'|\"](.*?)[\'|\"]/', $h[1][$i], $n)) {
13337 $this->pageHTMLheaders[$n[1]][
'html'] = $h[2][$i];
13338 $this->pageHTMLheaders[$n[1]][
'h'] = $this->_getHtmlHeight($h[2][$i]);
13341 preg_match_all(
'/<htmlpagefooter([^>]*)>(.*?)<\/htmlpagefooter>/si',
$html, $f);
13342 for ($i = 0; $i < count($f[1]); $i++) {
13343 if (preg_match(
'/name=[\'|\"](.*?)[\'|\"]/', $f[1][$i], $n)) {
13344 $this->pageHTMLfooters[$n[1]][
'html'] = $f[2][$i];
13345 $this->pageHTMLfooters[$n[1]][
'h'] = $this->_getHtmlHeight($f[2][$i]);
13349 $html = preg_replace(
'/<htmlpageheader.*?<\/htmlpageheader>/si',
'',
$html);
13350 $html = preg_replace(
'/<htmlpagefooter.*?<\/htmlpagefooter>/si',
'',
$html);
13353 $this->
AddPage($this->CurOrientation);
13357 if (isset($hname) && preg_match(
'/^html_(.*)$/i', $hname, $n)) {
13358 $this->SetHTMLHeader($this->pageHTMLheaders[$n[1]],
'O',
true);
13360 if (isset($fname) && preg_match(
'/^html_(.*)$/i', $fname, $n)) {
13361 $this->SetHTMLFooter($this->pageHTMLfooters[$n[1]],
'O');
13368 $this->checkSIP =
false;
13369 $this->checkSMP =
false;
13370 $this->checkCJK =
false;
13371 if ($this->onlyCoreFonts) {
13374 if (preg_match(
"/([" . $this->pregRTLchars .
"])/u",
$html)) {
13375 $this->biDirectional =
true;
13377 if (preg_match(
"/([\x{20000}-\x{2FFFF}])/u",
$html)) {
13378 $this->checkSIP =
true;
13380 if (preg_match(
"/([\x{10000}-\x{1FFFF}])/u",
$html)) {
13381 $this->checkSMP =
true;
13384 if (preg_match(
"/([" . $this->pregCJKchars .
"])/u",
$html)) {
13385 $this->checkCJK =
true;
13391 $html = str_replace(
'<tta>160</tta>', chr(32),
$html);
13392 $html = str_replace(
'</tta><tta>',
'|',
$html);
13393 $html = str_replace(
'</tts><tts>',
'|',
$html);
13394 $html = str_replace(
'</ttz><ttz>',
'|',
$html);
13397 $html = strip_tags(
$html, $this->enabledtags);
13399 $a = preg_split(
'/<(.*?)>/ms',
$html, -1, PREG_SPLIT_DELIM_CAPTURE);
13404 if ($this->mb_enc) {
13405 mb_internal_encoding($this->mb_enc);
13408 $this->subPos = -1;
13410 for ($i = 0; $i < $cnt; $i++) {
13414 if ($this->blk[$this->blklvl][
'hide']) {
13417 if ($this->inlineDisplayOff) {
13420 if ($this->inMeter) {
13424 if ($this->inFixedPosBlock) {
13425 $this->fixedPosBlock .= $e;
13428 if (strlen($e) == 0) {
13432 if ($this->ignorefollowingspaces && !$this->ispre) {
13433 if (strlen(ltrim($e)) == 0) {
13436 if ($this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats' && substr($e, 0, 1) ==
' ') {
13437 $this->ignorefollowingspaces =
false;
13442 $this->OTLdata =
null;
13445 $e = $this->lesser_entity_decode($e);
13447 if ($this->usingCoreFont) {
13449 if ($this->useSubstitutions && !$this->onlyCoreFonts && $this->subPos < $i && !$this->specialcontent) {
13450 $cnt += $this->SubstituteCharsNonCore($a, $i, $e);
13453 $e = mb_convert_encoding($e, $this->mb_enc,
'UTF-8');
13455 $e = mb_strtoupper($e, $this->mb_enc);
13458 $e = mb_strtolower($e, $this->mb_enc);
13461 $e = mb_convert_case($e, MB_CASE_TITLE,
"UTF-8");
13464 if ($this->checkSIP && $this->CurrentFont[
'sipext'] && $this->subPos < $i && (!$this->specialcontent || !$this->useActiveForms)) {
13465 $cnt += $this->SubstituteCharsSIP($a, $i, $e);
13468 if ($this->useSubstitutions && !$this->onlyCoreFonts && $this->CurrentFont[
'type'] !=
'Type0' && $this->subPos < $i && (!$this->specialcontent || !$this->useActiveForms)) {
13469 $cnt += $this->SubstituteCharsMB($a, $i, $e);
13473 $e = mb_strtoupper($e, $this->mb_enc);
13475 $e = mb_strtolower($e, $this->mb_enc);
13477 $e = mb_convert_case($e, MB_CASE_TITLE,
"UTF-8");
13482 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL'] && (!$this->specialcontent || !$this->useActiveForms)) {
13484 $this->otl =
new Otl($this, $this->fontCache);
13486 $e = $this->otl->applyOTL($e, $this->CurrentFont[
'useOTL']);
13487 $this->OTLdata = $this->otl->OTLdata;
13488 $this->otl->removeChar($e, $this->OTLdata,
"\xef\xbb\xbf");
13492 $e = preg_replace(
"/[\xe2\x80\x8c\xe2\x80\x8d\xe2\x80\x8e\xe2\x80\x8f]/u",
'', $e);
13493 $e = preg_replace(
"/[\xef\xbb\xbf]/u",
'', $e);
13497 if (($this->tts) || ($this->ttz) || ($this->tta)) {
13498 $es = explode(
'|', $e);
13500 foreach ($es as $val) {
13506 if ($this->specialcontent) {
13509 if ($this->specialcontent ==
"type=select") {
13511 if (!empty($this->OTLdata)) {
13512 $this->otl->trimOTLdata($this->OTLdata,
true,
false);
13514 $stringwidth = $this->GetStringWidth($e);
13515 if (!isset($this->selectoption[
'MAXWIDTH']) || $stringwidth > $this->selectoption[
'MAXWIDTH']) {
13516 $this->selectoption[
'MAXWIDTH'] = $stringwidth;
13518 if (!isset($this->selectoption[
'SELECTED']) || $this->selectoption[
'SELECTED'] ==
'') {
13519 $this->selectoption[
'SELECTED'] = $e;
13520 if (!empty($this->OTLdata)) {
13521 $this->selectoption[
'SELECTED-OTLDATA'] = $this->OTLdata;
13525 if (isset($this->selectoption[
'ACTIVE']) && $this->selectoption[
'ACTIVE']) {
13526 $this->selectoption[
'ITEMS'][] = [
'exportValue' => $this->selectoption[
'currentVAL'],
'content' => $e,
'selected' => $this->selectoption[
'currentSEL']];
13528 $this->OTLdata = [];
13531 $objattr = unserialize($this->specialcontent);
13532 $objattr[
'text'] = $e;
13533 $objattr[
'OTLdata'] = $this->OTLdata;
13534 $this->OTLdata = [];
13535 $te =
"\xbb\xa4\xactype=textarea,objattr=" . serialize($objattr) .
"\xbb\xa4\xac";
13536 if ($this->tdbegin) {
13537 $this->_saveCellTextBuffer($te, $this->HREF);
13539 $this->_saveTextBuffer($te, $this->HREF);
13544 elseif ($this->tableLevel) {
13546 if ($this->tdbegin) {
13547 if (($this->ignorefollowingspaces) && !$this->ispre) {
13549 if (!empty($this->OTLdata)) {
13550 $this->otl->trimOTLdata($this->OTLdata,
true,
false);
13553 if ($e || $e ===
'0') {
13554 if ($this->blockjustfinished && $this->cell[$this->row][$this->col][
's'] > 0) {
13555 $this->_saveCellTextBuffer(
"\n");
13556 if (!isset($this->cell[$this->row][$this->col][
'maxs'])) {
13557 $this->cell[$this->row][$this->col][
'maxs'] = $this->cell[$this->row][$this->col][
's'];
13558 } elseif ($this->cell[$this->row][$this->col][
'maxs'] < $this->cell[$this->row][$this->col][
's']) {
13559 $this->cell[$this->row][$this->col][
'maxs'] = $this->cell[$this->row][$this->col][
's'];
13561 $this->cell[$this->row][$this->col][
's'] = 0;
13563 $this->blockjustfinished =
false;
13565 if (!isset($this->cell[$this->row][$this->col][
'R']) || !$this->cell[$this->row][$this->col][
'R']) {
13566 if (isset($this->cell[$this->row][$this->col][
's'])) {
13567 $this->cell[$this->row][$this->col][
's'] += $this->GetStringWidth($e,
false, $this->OTLdata, $this->textvar);
13569 $this->cell[$this->row][$this->col][
's'] = $this->GetStringWidth($e,
false, $this->OTLdata, $this->textvar);
13571 if (!empty($this->spanborddet)) {
13572 $this->cell[$this->row][$this->col][
's'] += (isset($this->spanborddet[
'L'][
'w']) ? $this->spanborddet[
'L'][
'w'] : 0) + (isset($this->spanborddet[
'R'][
'w']) ? $this->spanborddet[
'R'][
'w'] : 0);
13576 $this->_saveCellTextBuffer($e, $this->HREF);
13578 if (substr($this->cell[$this->row][$this->col][
'a'], 0, 1) ==
'D') {
13580 $dp = $this->decimal_align[substr($this->cell[$this->row][$this->col][
'a'], 0, 2)];
13581 $s = preg_split(
'/' . preg_quote($dp,
'/') .
'/', $e, 2);
13582 $s0 = $this->GetStringWidth($s[0],
false);
13584 if (isset($s[1]) && $s[1]) {
13585 $s1 = $this->GetStringWidth(($s[1] . $dp),
false);
13590 if (!isset($this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs0'])) {
13591 if ($this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'] ===
false) {
13592 $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'] = [];
13594 $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs0'] = $s0;
13596 $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs0'] = max($s0, $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs0']);
13599 if (!isset($this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs1'])) {
13600 $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs1'] = $s1;
13602 $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs1'] = max($s1, $this->table[$this->tableLevel][$this->tbctr[$this->tableLevel]][
'decimal_align'][$this->col][
'maxs1']);
13606 $this->nestedtablejustfinished =
false;
13607 $this->linebreakjustfinished =
false;
13613 if ($this->ignorefollowingspaces && !$this->ispre) {
13615 if (!empty($this->OTLdata)) {
13616 $this->otl->trimOTLdata($this->OTLdata,
true,
false);
13619 if ($e || $e ===
'0') {
13620 $this->_saveTextBuffer($e, $this->HREF);
13623 if ($e || $e ===
'0') {
13624 $this->ignorefollowingspaces =
false;
13626 if (substr($e, -1, 1) ==
' ' && !$this->ispre && $this->FontFamily !=
'csymbol' && $this->FontFamily !=
'czapfdingbats') {
13627 $this->ignorefollowingspaces =
true;
13630 if (isset($e[0]) && $e[0] ==
'/') {
13631 $endtag = trim(strtoupper(substr($e, 1)));
13635 if ($this->inFixedPosBlock) {
13636 if (in_array($endtag, $this->outerblocktags) || in_array($endtag, $this->innerblocktags)) {
13637 $this->fixedPosBlockDepth--;
13639 if ($this->fixedPosBlockDepth == 0) {
13640 $this->fixedPosBlockSave[] = [$this->fixedPosBlock, $this->fixedPosBlockBBox, $this->page];
13641 $this->fixedPosBlock =
'';
13642 $this->inFixedPosBlock =
false;
13645 $this->fixedPosBlock .=
'<' . $e .
'>';
13652 if ($this->allow_html_optional_endtags && !$parseonly) {
13653 if (isset($this->blk[$this->blklvl][
'tag'])) {
13656 if (!$closed && $this->blk[$this->blklvl][
'tag'] ==
'LI' && $endtag !=
'LI' && (in_array($endtag, $this->outerblocktags) || in_array($endtag, $this->innerblocktags))) {
13657 $this->tag->CloseTag(
'LI', $a, $i);
13661 if (!$closed && $this->blk[$this->blklvl][
'tag'] ==
'DD' && $endtag !=
'DD' && (in_array($endtag, $this->outerblocktags) || in_array($endtag, $this->innerblocktags))) {
13662 $this->tag->CloseTag(
'DD', $a, $i);
13666 if (!$closed && $this->blk[$this->blklvl][
'tag'] ==
'P' && $endtag !=
'P' && (in_array($endtag, $this->outerblocktags) || in_array($endtag, $this->innerblocktags))) {
13667 $this->tag->CloseTag(
'P', $a, $i);
13671 if (!$closed && $this->blk[$this->blklvl][
'tag'] ==
'OPTION' && $endtag !=
'OPTION' && (in_array($endtag, $this->outerblocktags) || in_array($endtag, $this->innerblocktags))) {
13672 $this->tag->CloseTag(
'OPTION', $a, $i);
13678 if ($endtag ==
'TABLE') {
13679 if ($this->lastoptionaltag ==
'THEAD' || $this->lastoptionaltag ==
'TBODY' || $this->lastoptionaltag ==
'TFOOT') {
13680 $this->tag->CloseTag($this->lastoptionaltag, $a, $i);
13682 if ($this->lastoptionaltag ==
'TR') {
13683 $this->tag->CloseTag(
'TR', $a, $i);
13685 if ($this->lastoptionaltag ==
'TD' || $this->lastoptionaltag ==
'TH') {
13686 $this->tag->CloseTag($this->lastoptionaltag, $a, $i);
13687 $this->tag->CloseTag(
'TR', $a, $i);
13690 if ($endtag ==
'THEAD' || $endtag ==
'TBODY' || $endtag ==
'TFOOT') {
13691 if ($this->lastoptionaltag ==
'TR') {
13692 $this->tag->CloseTag(
'TR', $a, $i);
13694 if ($this->lastoptionaltag ==
'TD' || $this->lastoptionaltag ==
'TH') {
13695 $this->tag->CloseTag($this->lastoptionaltag, $a, $i);
13696 $this->tag->CloseTag(
'TR', $a, $i);
13699 if ($endtag ==
'TR') {
13700 if ($this->lastoptionaltag ==
'TD' || $this->lastoptionaltag ==
'TH') {
13701 $this->tag->CloseTag($this->lastoptionaltag, $a, $i);
13709 if ($this->blk[$this->blklvl][
'hide']) {
13710 if (in_array($endtag, $this->outerblocktags) || in_array($endtag, $this->innerblocktags)) {
13711 unset($this->blk[$this->blklvl]);
13718 $this->tag->CloseTag($endtag, $a, $i);
13720 if ($this->blk[$this->blklvl][
'hide']) {
13721 if (strpos($e,
' ')) {
13722 $te = strtoupper(substr($e, 0, strpos($e,
' ')));
13724 $te = strtoupper($e);
13727 if ($te ==
'THEAD' || $te ==
'TBODY' || $te ==
'TFOOT' || $te ==
'TR' || $te ==
'TD' || $te ==
'TH') {
13728 $this->lastoptionaltag = $te;
13730 if (in_array($te, $this->outerblocktags) || in_array($te, $this->innerblocktags)) {
13732 $this->blk[$this->blklvl][
'hide'] =
true;
13733 $this->blk[$this->blklvl][
'tag'] = $te;
13739 if ($this->inFixedPosBlock) {
13740 if (strpos($e,
' ')) {
13741 $te = strtoupper(substr($e, 0, strpos($e,
' ')));
13743 $te = strtoupper($e);
13745 $this->fixedPosBlock .=
'<' . $e .
'>';
13746 if (in_array($te, $this->outerblocktags) || in_array($te, $this->innerblocktags)) {
13747 $this->fixedPosBlockDepth++;
13752 $regexp =
'|=\'(.*?)\'|s';
13753 $e = preg_replace($regexp,
"=\"\$1\"", $e);
13755 if (substr($e, 0, 10) !=
'pageheader' && substr($e, 0, 10) !=
'pagefooter' && substr($e, 0, 12) !=
'tocpagebreak' && substr($e, 0, 10) !=
'indexentry' && substr($e, 0, 8) !=
'tocentry') {
13756 $regexp =
'| (\\w+?)=([^\\s>"]+)|si';
13757 $e = preg_replace($regexp,
" \$1=\"\$2\"", $e);
13760 $e = preg_replace(
'/ (\\S+?)\s*=\s*"/i',
" \\1=\"", $e);
13763 $orig_srcpath =
'';
13764 if ((stristr($e,
"href=") !==
false) or ( stristr($e,
"src=") !==
false)) {
13765 $regexp =
'/ (href|src)\s*=\s*"(.*?)"/i';
13766 preg_match($regexp, $e, $auxiliararray);
13767 if (isset($auxiliararray[2])) {
13768 $path = $auxiliararray[2];
13772 if (trim(
$path) !=
'' && !(stristr($e,
"src=") !==
false && substr(
$path, 0, 4) ==
'var:') && substr(
$path, 0, 1) !=
'@') {
13774 $orig_srcpath =
$path;
13775 $this->GetFullPath(
$path);
13776 $regexp =
'/ (href|src)="(.*?)"/i';
13777 $e = preg_replace($regexp,
' \\1="' .
$path .
'"', $e);
13787 preg_match_all(
'/\\S{1,32}=["][^"]*["]/', $e, $contents1);
13788 preg_match_all(
'/\\S{1,32}=[\'][^\']*[\']/i', $e, $contents2);
13790 $contents = array_merge($contents1, $contents2);
13791 preg_match(
'/\\S+/', $e, $a2);
13792 $tag = (isset($a2[0]) ? strtoupper($a2[0]) :
'');
13794 if ($orig_srcpath) {
13795 $attr[
'ORIG_SRC'] = $orig_srcpath;
13797 if (!empty($contents)) {
13798 foreach ($contents[0] as $v) {
13800 if (preg_match(
'/^([^=]*)=["]?([^"]*)["]?$/', $v, $a3) || preg_match(
'/^([^=]*)=[\']?([^\']*)[\']?$/', $v, $a3)) {
13801 if (strtoupper($a3[1]) ==
'ID' || strtoupper($a3[1]) ==
'CLASS') {
13802 $attr[strtoupper($a3[1])] = trim(strtoupper($a3[2]));
13804 elseif (preg_match(
'/^(HEADER|FOOTER)-STYLE/i', $a3[1])) {
13805 $attr[strtoupper($a3[1])] = trim(strtoupper($a3[2]));
13807 $attr[strtoupper($a3[1])] = trim($a3[2]);
13812 $this->tag->OpenTag($tag, $attr, $a, $i);
13814 if ($this->inFixedPosBlock) {
13815 $this->fixedPosBlockBBox = [$tag, $attr, $this->x, $this->y];
13816 $this->fixedPosBlock =
'';
13817 $this->fixedPosBlockDepth = 1;
13820 if (preg_match(
'/\/$/', $e)) {
13821 $this->tag->CloseTag($tag, $a, $i);
13829 for ($b = $this->blklvl; $b > 0; $b--) {
13830 $this->tag->CloseTag($this->blk[$b][
'tag'], $a, $i);
13834 if (count($this->textbuffer) && !$parseonly) {
13835 $this->printbuffer($this->textbuffer);
13838 $this->textbuffer = [];
13843 $currpos = $this->page * 1000 + $this->y;
13844 if (isset($this->blk[$this->blklvl][
'float_endpos']) && $this->blk[$this->blklvl][
'float_endpos'] > $currpos) {
13845 $old_page = $this->page;
13846 $new_page = intval($this->blk[$this->blklvl][
'float_endpos'] / 1000);
13847 if ($old_page != $new_page) {
13848 $s = $this->PrintPageBackgrounds();
13850 $this->pages[$this->page] = preg_replace(
'/(___BACKGROUND___PATTERNS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->pages[$this->page]);
13851 $this->pageBackgrounds = [];
13852 $this->page = $new_page;
13853 $this->ResetMargins();
13855 $this->pageoutput[$this->page] = [];
13857 $this->y = (round($this->blk[$this->blklvl][
'float_endpos'] * 1000) % 1000000) / 1000;
13862 $this->printfloatbuffer();
13866 if (!empty($this->internallink)) {
13868 foreach ($this->internallink as $k => $v) {
13870 if (strpos($k,
"#") !==
false) {
13874 if (!is_array($v)) {
13879 $pagenum = $v[
'PAGE'];
13882 while (array_key_exists($sharp . $k, $this->internallink)) {
13883 $internallink = $this->internallink[$sharp . $k];
13884 $this->
SetLink($internallink, $ypos, $pagenum);
13890 $this->bufferoutput =
false;
13893 if (count($this->fixedPosBlockSave)) {
13894 foreach ($this->fixedPosBlockSave as $fpbs) {
13895 $old_page = $this->page;
13896 $this->page = $fpbs[2];
13897 $this->WriteFixedPosHTML($fpbs[0], 0, 0, 100, 100,
'auto', $fpbs[1]);
13898 $this->page = $old_page;
13900 $this->fixedPosBlockSave = [];
13918 $overflow = strtolower($overflow);
13919 if ($this->state == 0) {
13920 $this->
AddPage($this->CurOrientation);
13922 $save_y = $this->y;
13923 $save_x = $this->x;
13924 $this->fullImageHeight = $this->h;
13925 $save_cols =
false;
13927 if ($this->ColActive) {
13929 $save_nbcol = $this->NbCol;
13930 $this->SetColumns(0);
13933 $save_annots = $this->title2annots;
13934 $this->writingHTMLheader =
true;
13935 $this->writingHTMLfooter =
true;
13936 $this->InFooter =
true;
13937 $save_bgs = $this->pageBackgrounds;
13938 $checkinnerhtml = preg_replace(
'/\s/',
'',
$html);
13941 if ($w > $this->w) {
13945 if ($h > $this->h) {
13949 if ($x > $this->w) {
13950 $x = $this->w - $w;
13952 if ($y > $this->h) {
13953 $y = $this->h - $h;
13956 if (!empty($bounding)) {
13964 $tag = $bounding[0];
13965 $attr = $bounding[1];
13966 $orig_x0 = $bounding[2];
13967 $orig_y0 = $bounding[3];
13971 $this->lastblocklevelchange = 0;
13973 $this->initialiseBlock($this->blk[0]);
13975 $this->blk[0][
'width'] = & $this->pgwidth;
13976 $this->blk[0][
'inner_width'] = & $this->pgwidth;
13978 $this->blk[0][
'blockContext'] = $this->blockContext;
13980 $properties = $this->cssManager->MergeCSS(
'BLOCK',
'BODY',
'');
13981 $this->setCSS($properties,
'',
'BODY');
13983 $this->initialiseBlock($this->blk[1]);
13984 $this->blk[1][
'tag'] = $tag;
13985 $this->blk[1][
'attr'] = $attr;
13987 $p = $this->cssManager->MergeCSS(
'BLOCK', $tag, $attr);
13988 if (isset($p[
'ROTATE']) && ($p[
'ROTATE'] == 90 || $p[
'ROTATE'] == -90 || $p[
'ROTATE'] == 180)) {
13989 $rotate = $p[
'ROTATE'];
13991 if (isset($p[
'OVERFLOW'])) {
13992 $overflow = strtolower($p[
'OVERFLOW']);
13994 if (strtolower($p[
'POSITION']) ==
'fixed') {
13995 $cont_w = $this->pgwidth;
13996 $cont_h = $this->h - $this->tMargin - $this->bMargin;
13997 $cont_x = $this->lMargin;
13998 $cont_y = $this->tMargin;
14000 $cont_w = $this->w;
14001 $cont_h = $this->h;
14008 if (isset($p[
'TEXT-ALIGN'])) {
14009 $css .=
'text-align: ' . strtolower($p[
'TEXT-ALIGN']) .
'; ';
14011 if (isset($p[
'TEXT-TRANSFORM'])) {
14012 $css .=
'text-transform: ' . strtolower($p[
'TEXT-TRANSFORM']) .
'; ';
14014 if (isset($p[
'TEXT-INDENT'])) {
14015 $css .=
'text-indent: ' . strtolower($p[
'TEXT-INDENT']) .
'; ';
14017 if (isset($p[
'TEXT-DECORATION'])) {
14018 $css .=
'text-decoration: ' . strtolower($p[
'TEXT-DECORATION']) .
'; ';
14020 if (isset($p[
'FONT-FAMILY'])) {
14021 $css .=
'font-family: ' . strtolower($p[
'FONT-FAMILY']) .
'; ';
14023 if (isset($p[
'FONT-STYLE'])) {
14024 $css .=
'font-style: ' . strtolower($p[
'FONT-STYLE']) .
'; ';
14026 if (isset($p[
'FONT-WEIGHT'])) {
14027 $css .=
'font-weight: ' . strtolower($p[
'FONT-WEIGHT']) .
'; ';
14029 if (isset($p[
'FONT-SIZE'])) {
14030 $css .=
'font-size: ' . strtolower($p[
'FONT-SIZE']) .
'; ';
14032 if (isset($p[
'LINE-HEIGHT'])) {
14033 $css .=
'line-height: ' . strtolower($p[
'LINE-HEIGHT']) .
'; ';
14035 if (isset($p[
'TEXT-SHADOW'])) {
14036 $css .=
'text-shadow: ' . strtolower($p[
'TEXT-SHADOW']) .
'; ';
14038 if (isset($p[
'LETTER-SPACING'])) {
14039 $css .=
'letter-spacing: ' . strtolower($p[
'LETTER-SPACING']) .
'; ';
14042 if (isset($p[
'FONT-VARIANT-POSITION'])) {
14043 $css .=
'font-variant-position: ' . strtolower($p[
'FONT-VARIANT-POSITION']) .
'; ';
14045 if (isset($p[
'FONT-VARIANT-CAPS'])) {
14046 $css .=
'font-variant-caps: ' . strtolower($p[
'FONT-VARIANT-CAPS']) .
'; ';
14048 if (isset($p[
'FONT-VARIANT-LIGATURES'])) {
14049 $css .=
'font-variant-ligatures: ' . strtolower($p[
'FONT-VARIANT-LIGATURES']) .
'; ';
14051 if (isset($p[
'FONT-VARIANT-NUMERIC'])) {
14052 $css .=
'font-variant-numeric: ' . strtolower($p[
'FONT-VARIANT-NUMERIC']) .
'; ';
14054 if (isset($p[
'FONT-VARIANT-ALTERNATES'])) {
14055 $css .=
'font-variant-alternates: ' . strtolower($p[
'FONT-VARIANT-ALTERNATES']) .
'; ';
14057 if (isset($p[
'FONT-FEATURE-SETTINGS'])) {
14058 $css .=
'font-feature-settings: ' . strtolower($p[
'FONT-FEATURE-SETTINGS']) .
'; ';
14060 if (isset($p[
'FONT-LANGUAGE-OVERRIDE'])) {
14061 $css .=
'font-language-override: ' . strtolower($p[
'FONT-LANGUAGE-OVERRIDE']) .
'; ';
14063 if (isset($p[
'FONT-KERNING'])) {
14064 $css .=
'font-kerning: ' . strtolower($p[
'FONT-KERNING']) .
'; ';
14067 if (isset($p[
'COLOR'])) {
14068 $css .=
'color: ' . strtolower($p[
'COLOR']) .
'; ';
14070 if (isset($p[
'Z-INDEX'])) {
14071 $css .=
'z-index: ' . $p[
'Z-INDEX'] .
'; ';
14074 $html =
'<div style="' . $css .
'">' .
$html .
'</div>';
14078 $pb[
'MARGIN-TOP'] = (isset($p[
'MARGIN-TOP']) ? $p[
'MARGIN-TOP'] :
'');
14079 $pb[
'MARGIN-RIGHT'] = (isset($p[
'MARGIN-RIGHT']) ? $p[
'MARGIN-RIGHT'] :
'');
14080 $pb[
'MARGIN-BOTTOM'] = (isset($p[
'MARGIN-BOTTOM']) ? $p[
'MARGIN-BOTTOM'] :
'');
14081 $pb[
'MARGIN-LEFT'] = (isset($p[
'MARGIN-LEFT']) ? $p[
'MARGIN-LEFT'] :
'');
14082 $pb[
'PADDING-TOP'] = (isset($p[
'PADDING-TOP']) ? $p[
'PADDING-TOP'] :
'');
14083 $pb[
'PADDING-RIGHT'] = (isset($p[
'PADDING-RIGHT']) ? $p[
'PADDING-RIGHT'] :
'');
14084 $pb[
'PADDING-BOTTOM'] = (isset($p[
'PADDING-BOTTOM']) ? $p[
'PADDING-BOTTOM'] :
'');
14085 $pb[
'PADDING-LEFT'] = (isset($p[
'PADDING-LEFT']) ? $p[
'PADDING-LEFT'] :
'');
14086 $pb[
'BORDER-TOP'] = (isset($p[
'BORDER-TOP']) ? $p[
'BORDER-TOP'] :
'');
14087 $pb[
'BORDER-RIGHT'] = (isset($p[
'BORDER-RIGHT']) ? $p[
'BORDER-RIGHT'] :
'');
14088 $pb[
'BORDER-BOTTOM'] = (isset($p[
'BORDER-BOTTOM']) ? $p[
'BORDER-BOTTOM'] :
'');
14089 $pb[
'BORDER-LEFT'] = (isset($p[
'BORDER-LEFT']) ? $p[
'BORDER-LEFT'] :
'');
14090 if (isset($p[
'BORDER-TOP-LEFT-RADIUS-H'])) {
14091 $pb[
'BORDER-TOP-LEFT-RADIUS-H'] = $p[
'BORDER-TOP-LEFT-RADIUS-H'];
14093 if (isset($p[
'BORDER-TOP-LEFT-RADIUS-V'])) {
14094 $pb[
'BORDER-TOP-LEFT-RADIUS-V'] = $p[
'BORDER-TOP-LEFT-RADIUS-V'];
14096 if (isset($p[
'BORDER-TOP-RIGHT-RADIUS-H'])) {
14097 $pb[
'BORDER-TOP-RIGHT-RADIUS-H'] = $p[
'BORDER-TOP-RIGHT-RADIUS-H'];
14099 if (isset($p[
'BORDER-TOP-RIGHT-RADIUS-V'])) {
14100 $pb[
'BORDER-TOP-RIGHT-RADIUS-V'] = $p[
'BORDER-TOP-RIGHT-RADIUS-V'];
14102 if (isset($p[
'BORDER-BOTTOM-LEFT-RADIUS-H'])) {
14103 $pb[
'BORDER-BOTTOM-LEFT-RADIUS-H'] = $p[
'BORDER-BOTTOM-LEFT-RADIUS-H'];
14105 if (isset($p[
'BORDER-BOTTOM-LEFT-RADIUS-V'])) {
14106 $pb[
'BORDER-BOTTOM-LEFT-RADIUS-V'] = $p[
'BORDER-BOTTOM-LEFT-RADIUS-V'];
14108 if (isset($p[
'BORDER-BOTTOM-RIGHT-RADIUS-H'])) {
14109 $pb[
'BORDER-BOTTOM-RIGHT-RADIUS-H'] = $p[
'BORDER-BOTTOM-RIGHT-RADIUS-H'];
14111 if (isset($p[
'BORDER-BOTTOM-RIGHT-RADIUS-V'])) {
14112 $pb[
'BORDER-BOTTOM-RIGHT-RADIUS-V'] = $p[
'BORDER-BOTTOM-RIGHT-RADIUS-V'];
14114 if (isset($p[
'BACKGROUND-COLOR'])) {
14115 $pb[
'BACKGROUND-COLOR'] = $p[
'BACKGROUND-COLOR'];
14117 if (isset($p[
'BOX-SHADOW'])) {
14118 $pb[
'BOX-SHADOW'] = $p[
'BOX-SHADOW'];
14121 if (isset($p[
'BACKGROUND-IMAGE'])) {
14122 $pb[
'BACKGROUND-IMAGE'] = $p[
'BACKGROUND-IMAGE'];
14124 if (isset($p[
'BACKGROUND-IMAGE-RESIZE'])) {
14125 $pb[
'BACKGROUND-IMAGE-RESIZE'] = $p[
'BACKGROUND-IMAGE-RESIZE'];
14127 if (isset($p[
'BACKGROUND-IMAGE-OPACITY'])) {
14128 $pb[
'BACKGROUND-IMAGE-OPACITY'] = $p[
'BACKGROUND-IMAGE-OPACITY'];
14130 if (isset($p[
'BACKGROUND-REPEAT'])) {
14131 $pb[
'BACKGROUND-REPEAT'] = $p[
'BACKGROUND-REPEAT'];
14133 if (isset($p[
'BACKGROUND-POSITION'])) {
14134 $pb[
'BACKGROUND-POSITION'] = $p[
'BACKGROUND-POSITION'];
14136 if (isset($p[
'BACKGROUND-GRADIENT'])) {
14137 $pb[
'BACKGROUND-GRADIENT'] = $p[
'BACKGROUND-GRADIENT'];
14139 if (isset($p[
'BACKGROUND-SIZE'])) {
14140 $pb[
'BACKGROUND-SIZE'] = $p[
'BACKGROUND-SIZE'];
14142 if (isset($p[
'BACKGROUND-ORIGIN'])) {
14143 $pb[
'BACKGROUND-ORIGIN'] = $p[
'BACKGROUND-ORIGIN'];
14145 if (isset($p[
'BACKGROUND-CLIP'])) {
14146 $pb[
'BACKGROUND-CLIP'] = $p[
'BACKGROUND-CLIP'];
14151 $this->setCSS($pb,
'BLOCK', $tag);
14154 $bbox_br = $this->blk[1][
'border_right'][
'w'];
14155 $bbox_bl = $this->blk[1][
'border_left'][
'w'];
14156 $bbox_bt = $this->blk[1][
'border_top'][
'w'];
14157 $bbox_bb = $this->blk[1][
'border_bottom'][
'w'];
14158 $bbox_pr = $this->blk[1][
'padding_right'];
14159 $bbox_pl = $this->blk[1][
'padding_left'];
14160 $bbox_pt = $this->blk[1][
'padding_top'];
14161 $bbox_pb = $this->blk[1][
'padding_bottom'];
14162 $bbox_mr = $this->blk[1][
'margin_right'];
14163 if (isset($p[
'MARGIN-RIGHT']) && strtolower($p[
'MARGIN-RIGHT']) ==
'auto') {
14166 $bbox_ml = $this->blk[1][
'margin_left'];
14167 if (isset($p[
'MARGIN-LEFT']) && strtolower($p[
'MARGIN-LEFT']) ==
'auto') {
14170 $bbox_mt = $this->blk[1][
'margin_top'];
14171 if (isset($p[
'MARGIN-TOP']) && strtolower($p[
'MARGIN-TOP']) ==
'auto') {
14174 $bbox_mb = $this->blk[1][
'margin_bottom'];
14175 if (isset($p[
'MARGIN-BOTTOM']) && strtolower($p[
'MARGIN-BOTTOM']) ==
'auto') {
14178 if (isset($p[
'LEFT']) && strtolower($p[
'LEFT']) !=
'auto') {
14179 $bbox_left = $this->sizeConverter->convert($p[
'LEFT'], $cont_w, $this->FontSize,
false);
14181 $bbox_left =
'auto';
14183 if (isset($p[
'TOP']) && strtolower($p[
'TOP']) !=
'auto') {
14184 $bbox_top = $this->sizeConverter->convert($p[
'TOP'], $cont_h, $this->FontSize,
false);
14186 $bbox_top =
'auto';
14188 if (isset($p[
'RIGHT']) && strtolower($p[
'RIGHT']) !=
'auto') {
14189 $bbox_right = $this->sizeConverter->convert($p[
'RIGHT'], $cont_w, $this->FontSize,
false);
14191 $bbox_right =
'auto';
14193 if (isset($p[
'BOTTOM']) && strtolower($p[
'BOTTOM']) !=
'auto') {
14194 $bbox_bottom = $this->sizeConverter->convert($p[
'BOTTOM'], $cont_h, $this->FontSize,
false);
14196 $bbox_bottom =
'auto';
14198 if (isset($p[
'WIDTH']) && strtolower($p[
'WIDTH']) !=
'auto') {
14199 $inner_w = $this->sizeConverter->convert($p[
'WIDTH'], $cont_w, $this->FontSize,
false);
14203 if (isset($p[
'HEIGHT']) && strtolower($p[
'HEIGHT']) !=
'auto') {
14204 $inner_h = $this->sizeConverter->convert($p[
'HEIGHT'], $cont_h, $this->FontSize,
false);
14210 if ($rotate == 90 || $rotate == -90) {
14211 if ($bbox_left ===
'auto' && $bbox_right !==
'auto') {
14212 $rot_rpos = $bbox_right;
14216 if ($bbox_top ===
'auto' && $bbox_bottom !==
'auto') {
14217 $rot_bpos = $bbox_bottom;
14224 if ($checkinnerhtml ==
'' && $inner_h ===
'auto') {
14227 if ($checkinnerhtml ==
'' && $inner_w ===
'auto') {
14228 $inner_w = 2 * $this->GetCharWidth(
'W',
false);
14234 $bbox_top_orig =
'';
14235 if ($bbox_top ===
'auto' && $inner_h ===
'auto' && $bbox_bottom ===
'auto' && $bbox_mt ===
'auto' && $bbox_mb ===
'auto') {
14236 $bbox_top_orig = $bbox_top;
14237 if ($bbox_mt ===
'auto') {
14240 if ($bbox_mb ===
'auto') {
14243 $bbox_top = $orig_y0 - $bbox_mt - $cont_y;
14246 elseif ($bbox_top ===
'auto' && $inner_h ===
'auto' && $bbox_bottom ===
'auto') {
14247 $bbox_top_orig = $bbox_top = $orig_y0 - $cont_y;
14248 if ($bbox_mt ===
'auto') {
14251 if ($bbox_mb ===
'auto') {
14255 } elseif ($bbox_top !==
'auto' && $inner_h !==
'auto' && $bbox_bottom !==
'auto') {
14256 if ($bbox_mt ===
'auto' && $bbox_mb ===
'auto') {
14257 $x = $cont_h - $bbox_top - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_bottom;
14258 $bbox_mt = $bbox_mb = ($x / 2);
14259 } elseif ($bbox_mt ===
'auto') {
14260 $bbox_mt = $cont_h - $bbox_top - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mb - $bbox_bottom;
14261 } elseif ($bbox_mb ===
'auto') {
14262 $bbox_mb = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_bottom;
14264 $bbox_bottom = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mt;
14267 if ($bbox_mt ===
'auto') {
14270 if ($bbox_mb ===
'auto') {
14273 if ($bbox_top ===
'auto' && $inner_h ===
'auto' && $bbox_bottom !==
'auto') {
14275 } elseif ($bbox_top ===
'auto' && $bbox_bottom ===
'auto' && $inner_h !==
'auto') {
14276 $bbox_top = $orig_y0 - $bbox_mt - $cont_y;
14277 $bbox_bottom = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mt;
14278 } elseif ($inner_h ===
'auto' && $bbox_bottom ===
'auto' && $bbox_top !==
'auto') {
14280 } elseif ($bbox_top ===
'auto' && $inner_h !==
'auto' && $bbox_bottom !==
'auto') {
14281 $bbox_top = $cont_h - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mt - $bbox_bottom;
14282 } elseif ($inner_h ===
'auto' && $bbox_top !==
'auto' && $bbox_bottom !==
'auto') {
14283 $inner_h = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $bbox_pb - $bbox_bb - $bbox_mt - $bbox_bottom;
14284 } elseif ($bbox_bottom ===
'auto' && $bbox_top !==
'auto' && $inner_h !==
'auto') {
14285 $bbox_bottom = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mt;
14291 if ($bbox_left ===
'auto' && $inner_w ===
'auto' && $bbox_right ===
'auto') {
14292 if ($bbox_ml ===
'auto') {
14295 if ($bbox_mr ===
'auto') {
14299 $bbox_left = $orig_x0 - $bbox_ml - $cont_x;
14301 } elseif ($bbox_left !==
'auto' && $inner_w !==
'auto' && $bbox_right !==
'auto') {
14302 if ($bbox_ml ===
'auto' && $bbox_mr ===
'auto') {
14303 $x = $cont_w - $bbox_left - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_right;
14304 $bbox_ml = $bbox_mr = ($x / 2);
14305 } elseif ($bbox_ml ===
'auto') {
14306 $bbox_ml = $cont_w - $bbox_left - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_mr - $bbox_right;
14307 } elseif ($bbox_mr ===
'auto') {
14308 $bbox_mr = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_right;
14310 $bbox_right = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_ml;
14313 if ($bbox_ml ===
'auto') {
14316 if ($bbox_mr ===
'auto') {
14319 if ($bbox_left ===
'auto' && $inner_w ===
'auto' && $bbox_right !==
'auto') {
14321 } elseif ($bbox_left ===
'auto' && $bbox_right ===
'auto' && $inner_w !==
'auto') {
14323 $bbox_left = $orig_x0 - $bbox_ml - $cont_x;
14324 $bbox_right = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_ml;
14325 } elseif ($inner_w ===
'auto' && $bbox_right ===
'auto' && $bbox_left !==
'auto') {
14327 } elseif ($bbox_left ===
'auto' && $inner_w !==
'auto' && $bbox_right !==
'auto') {
14328 $bbox_left = $cont_w - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_ml - $bbox_right;
14329 } elseif ($inner_w ===
'auto' && $bbox_left !==
'auto' && $bbox_right !==
'auto') {
14330 $inner_w = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $bbox_pr - $bbox_br - $bbox_ml - $bbox_right;
14331 } elseif ($bbox_right ===
'auto' && $bbox_left !==
'auto' && $inner_w !==
'auto') {
14332 $bbox_right = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_ml;
14339 if (isset($pb[
'BACKGROUND-IMAGE']) && $pb[
'BACKGROUND-IMAGE']) {
14340 $ret = $this->SetBackground($pb, $this->blk[1][
'inner_width']);
14342 $this->blk[1][
'background-image'] = $ret;
14347 $bbox_top_auto = $bbox_top ===
'auto';
14348 $bbox_left_auto = $bbox_left ===
'auto';
14349 $bbox_right_auto = $bbox_right ===
'auto';
14350 $bbox_bottom_auto = $bbox_bottom ===
'auto';
14352 $bbox_top = is_numeric($bbox_top) ? $bbox_top : 0;
14353 $bbox_left = is_numeric($bbox_left) ? $bbox_left : 0;
14354 $bbox_right = is_numeric($bbox_right) ? $bbox_right : 0;
14355 $bbox_bottom = is_numeric($bbox_bottom) ? $bbox_bottom : 0;
14357 $y = $cont_y + $bbox_top + $bbox_mt + $bbox_bt + $bbox_pt;
14358 $h = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $bbox_pb - $bbox_bb - $bbox_mb - $bbox_bottom;
14360 $x = $cont_x + $bbox_left + $bbox_ml + $bbox_bl + $bbox_pl;
14361 $w = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $bbox_pr - $bbox_br - $bbox_mr - $bbox_right;
14364 if ($inner_h ===
'auto' && $bbox_top_auto) {
14365 $y = $cont_y + $bbox_mt + $bbox_bt + $bbox_pt;
14366 $h = $cont_h - ($bbox_bottom + $bbox_mt + $bbox_mb + $bbox_bt + $bbox_bb + $bbox_pt + $bbox_pb);
14367 } elseif ($inner_h ===
'auto' && $bbox_bottom_auto) {
14368 $y = $cont_y + $bbox_top + $bbox_mt + $bbox_bt + $bbox_pt;
14369 $h = $cont_h - ($bbox_top + $bbox_mt + $bbox_mb + $bbox_bt + $bbox_bb + $bbox_pt + $bbox_pb);
14371 if ($inner_w ===
'auto' && $bbox_left_auto) {
14372 $x = $cont_x + $bbox_ml + $bbox_bl + $bbox_pl;
14373 $w = $cont_w - ($bbox_right + $bbox_ml + $bbox_mr + $bbox_bl + $bbox_br + $bbox_pl + $bbox_pr);
14374 } elseif ($inner_w ===
'auto' && $bbox_right_auto) {
14375 $x = $cont_x + $bbox_left + $bbox_ml + $bbox_bl + $bbox_pl;
14376 $w = $cont_w - ($bbox_left + $bbox_ml + $bbox_mr + $bbox_bl + $bbox_br + $bbox_pl + $bbox_pr);
14379 $bbox_y = $cont_y + $bbox_top + $bbox_mt;
14380 $bbox_x = $cont_x + $bbox_left + $bbox_ml;
14382 $saved_block1 = $this->blk[1];
14388 if ($inner_w ===
'auto') {
14389 $this->lMargin = $x;
14390 $this->rMargin = $this->w - $w - $x;
14393 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
14394 $this->pageoutput[$this->page] = [];
14397 $this->HTMLheaderPageLinks = [];
14398 $this->HTMLheaderPageAnnots = [];
14399 $this->HTMLheaderPageForms = [];
14400 $this->pageBackgrounds = [];
14401 $this->maxPosR = 0;
14402 $this->maxPosL = $this->w;
14404 $inner_w = $this->maxPosR - $this->lMargin;
14405 if ($bbox_right_auto) {
14406 $bbox_right = $cont_w - $bbox_left - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_ml;
14407 } elseif ($bbox_left_auto) {
14408 $bbox_left = $cont_w - $bbox_ml - $bbox_bl - $bbox_pl - $inner_w - $bbox_pr - $bbox_br - $bbox_ml - $bbox_right;
14409 $bbox_x = $cont_x + $bbox_left + $bbox_ml;
14410 $inner_x = $bbox_x + $bbox_bl + $bbox_pl;
14415 $bbox_y = $cont_y + $bbox_top + $bbox_mt;
14416 $bbox_x = $cont_x + $bbox_left + $bbox_ml;
14419 if ($inner_h ===
'auto') {
14421 $this->lMargin = $x;
14422 $this->rMargin = $this->w - $w - $x;
14425 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
14426 $this->pageoutput[$this->page] = [];
14429 $this->HTMLheaderPageLinks = [];
14430 $this->HTMLheaderPageAnnots = [];
14431 $this->HTMLheaderPageForms = [];
14432 $this->pageBackgrounds = [];
14434 $inner_h = $this->y - $y;
14436 if ($overflow !=
'hidden' && $overflow !=
'visible') {
14437 if (($this->y + $bbox_pb + $bbox_bb) > ($cont_y + $cont_h)) {
14438 $adj = ($this->y + $bbox_pb + $bbox_bb) - ($cont_y + $cont_h);
14442 if ($bbox_bottom_auto && $bbox_top_orig ===
'auto') {
14443 $bbox_bottom = $bbox_top = ($cont_h - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mb) / 2;
14444 if ($overflow !=
'hidden' && $overflow !=
'visible') {
14445 if ($bbox_top < 0) {
14447 $inner_h = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $bbox_pb - $bbox_bb - $bbox_mb - $bbox_bottom;
14450 $bbox_y = $cont_y + $bbox_top + $bbox_mt;
14451 $inner_y = $bbox_y + $bbox_bt + $bbox_pt;
14453 } elseif ($bbox_bottom_auto) {
14454 $bbox_bottom = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mb;
14455 } elseif ($bbox_top_auto) {
14456 $bbox_top = $cont_h - $bbox_mt - $bbox_bt - $bbox_pt - $inner_h - $bbox_pb - $bbox_bb - $bbox_mb - $bbox_bottom;
14457 if ($overflow !=
'hidden' && $overflow !=
'visible') {
14458 if ($bbox_top < 0) {
14460 $inner_h = $cont_h - $bbox_top - $bbox_mt - $bbox_bt - $bbox_pt - $bbox_pb - $bbox_bb - $bbox_mb - $bbox_bottom;
14463 $bbox_y = $cont_y + $bbox_top + $bbox_mt;
14464 $inner_y = $bbox_y + $bbox_bt + $bbox_pt;
14468 $bbox_y = $cont_y + $bbox_top + $bbox_mt;
14469 $bbox_x = $cont_x + $bbox_left + $bbox_ml;
14476 $this->lMargin = $x;
14477 $this->rMargin = $this->w - $w - $x;
14480 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
14481 $this->pageoutput[$this->page] = [];
14486 $this->HTMLheaderPageLinks = [];
14487 $this->HTMLheaderPageAnnots = [];
14488 $this->HTMLheaderPageForms = [];
14490 $this->pageBackgrounds = [];
14494 $actual_h = $this->y - $y;
14497 $ratio = $actual_h / $use_w;
14499 if ($overflow !=
'hidden' && $overflow !=
'visible') {
14502 if (($ratio / $target) > 1) {
14503 $nl = ceil($actual_h / $this->lineheight);
14505 $est_w = sqrt(($l * $this->lineheight) / $target) * 0.8;
14506 $use_w += ($est_w - $use_w) - ($w / 100);
14508 $bpcstart = ($ratio / $target);
14511 while (($ratio / $target) > 1) {
14517 if (($ratio / $target) > 1.5 || ($ratio / $target) < 0.6) {
14518 $use_w += ($w / $this->incrementFPR1);
14519 } elseif (($ratio / $target) > 1.2 || ($ratio / $target) < 0.85) {
14520 $use_w += ($w / $this->incrementFPR2);
14521 } elseif (($ratio / $target) > 1.1 || ($ratio / $target) < 0.91) {
14522 $use_w += ($w / $this->incrementFPR3);
14524 $use_w += ($w / $this->incrementFPR4);
14527 $use_h = $use_w * $target;
14528 $this->rMargin = $this->w - $use_w - $x;
14529 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
14530 $this->HTMLheaderPageLinks = [];
14531 $this->HTMLheaderPageAnnots = [];
14532 $this->HTMLheaderPageForms = [];
14533 $this->pageBackgrounds = [];
14535 $actual_h = $this->y - $y;
14536 $ratio = $actual_h / $use_w;
14541 $shrink_f = $w / $use_w;
14545 $this->pages[$this->page] .=
'___BEFORE_BORDERS___';
14546 $block_s = $this->PrintPageBackgrounds();
14547 $this->pageBackgrounds = [];
14551 if ($rotate == 90 || $rotate == -90) {
14552 $prerotw = $bbox_bl + $bbox_pl + $inner_w + $bbox_pr + $bbox_br;
14553 $preroth = $bbox_bt + $bbox_pt + $inner_h + $bbox_pb + $bbox_bb;
14554 $rot_start =
" q\n";
14555 if ($rotate == 90) {
14556 if ($rot_rpos !==
false) {
14562 if ($rot_bpos !==
false) {
14563 $adjh = -$prerotw + $preroth;
14568 if ($rot_rpos !==
false) {
14569 $adjw = $prerotw - $preroth;
14573 if ($rot_bpos !==
false) {
14580 $rot_start .= $this->transformTranslate($adjw, $adjh,
true) .
"\n";
14581 $rot_start .= $this->transformRotate($rotate, $bbox_x, $bbox_y,
true) .
"\n";
14583 } elseif ($rotate == 180) {
14584 $rot_start =
" q\n";
14585 $rot_start .= $this->transformTranslate($bbox_bl + $bbox_pl + $inner_w + $bbox_pr + $bbox_br, $bbox_bt + $bbox_pt + $inner_h + $bbox_pb + $bbox_bb,
true) .
"\n";
14586 $rot_start .= $this->transformRotate(180, $bbox_x, $bbox_y,
true) .
"\n";
14594 if (!empty($bounding)) {
14597 $this->blk[1] = $saved_block1;
14600 $this->blk[1][
'width'] = $bbox_w = $cont_w - $bbox_left - $bbox_ml - $bbox_mr - $bbox_right;
14601 $this->blk[1][
'x0'] = $bbox_x;
14602 $this->blk[1][
'y0'] = $bbox_y;
14603 $this->blk[1][
'startpage'] = $this->page;
14604 $this->blk[1][
'y1'] = $bbox_y + $bbox_bt + $bbox_pt + $inner_h + $bbox_pb + $bbox_bb;
14605 $this->writer->write($rot_start);
14606 $this->PaintDivBB(
'', 0, 1);
14607 $this->writer->write($rot_end);
14610 $s = $this->PrintPageBackgrounds();
14611 $s = $rot_start . $s . $rot_end;
14612 $this->pages[$this->page] = preg_replace(
'/___BEFORE_BORDERS___/',
"\n" . $s .
"\n", $this->pages[$this->page]);
14613 $this->pageBackgrounds = [];
14615 $this->writer->write($rot_start);
14618 if ($overflow ==
'hidden') {
14620 $clip_y1 = $this->y;
14621 if (!empty($bounding) && ($this->y + $bbox_pb + $bbox_bb) > ($bbox_y + $bbox_bt + $bbox_pt + $inner_h + $bbox_pb + $bbox_bb )) {
14622 $clip_y1 = ($bbox_y + $bbox_bt + $bbox_pt + $inner_h + $bbox_pb + $bbox_bb ) - ($bbox_pb + $bbox_bb);
14626 $this->writer->write(
"q");
14627 $ch = $clip_y1 - $y;
14628 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F re %s', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $w * Mpdf::SCALE, -$ch * Mpdf::SCALE, $op));
14629 if (!empty($block_s)) {
14630 $tmp =
"q\n" . sprintf(
'%.3F %.3F %.3F %.3F re %s', $x * Mpdf::SCALE, ($this->h - $y) * Mpdf::SCALE, $w * Mpdf::SCALE, -$ch * Mpdf::SCALE, $op);
14631 $tmp .=
"\n" . $block_s .
"\nQ";
14637 if (!empty($block_s)) {
14638 if ($shrink_f != 1) {
14639 $tmp =
"q\n" . $this->transformScale(($shrink_f * 100), ($shrink_f * 100), $x, $y,
true);
14640 $tmp .=
"\n" . $block_s .
"\nQ";
14643 $this->writer->write($block_s);
14648 if ($shrink_f != 1) {
14649 $this->StartTransform();
14650 $this->transformScale(($shrink_f * 100), ($shrink_f * 100), $x, $y);
14653 $this->writer->write($this->headerbuffer);
14655 if ($shrink_f != 1) {
14656 $this->StopTransform();
14659 if ($overflow ==
'hidden') {
14661 $this->writer->write(
"Q");
14664 $this->writer->write($rot_end);
14668 foreach ($this->HTMLheaderPageLinks as $lk) {
14674 $lx1 = (($lk[0] / Mpdf::SCALE));
14675 $ly1 = (($this->h - ($lk[1] / Mpdf::SCALE)));
14676 if ($rotate == 90) {
14677 $adjx = -($lx1 - $bbox_x) + ($preroth - ($ly1 - $bbox_y));
14678 $adjy = -($ly1 - $bbox_y) + ($lx1 - $bbox_x);
14680 } elseif ($rotate == -90) {
14681 $adjx = -($lx1 - $bbox_x) + ($ly1 - $bbox_y);
14682 $adjy = -($ly1 - $bbox_y) - ($lx1 - $bbox_x) + $prerotw;
14685 if ($rot_rpos !==
false) {
14686 $adjx += $prerotw - $preroth;
14688 if ($rot_bpos !==
false) {
14689 $adjy += $preroth - $prerotw;
14694 $lk[0] = $lx1 * Mpdf::SCALE;
14695 $lk[1] = ($this->h - $ly1) * Mpdf::SCALE;
14697 if ($shrink_f != 1) {
14698 $lx1 = (($lk[0] / Mpdf::SCALE) - $x);
14699 $lx2 = $x + ($lx1 * $shrink_f);
14700 $lk[0] = $lx2 * Mpdf::SCALE;
14701 $ly1 = (($this->h - ($lk[1] / Mpdf::SCALE)) - $y);
14702 $ly2 = $y + ($ly1 * $shrink_f);
14703 $lk[1] = ($this->h - $ly2) * Mpdf::SCALE;
14704 $lk[2] *= $shrink_f;
14705 $lk[3] *= $shrink_f;
14707 $this->PageLinks[$this->page][] = $lk;
14710 foreach ($this->HTMLheaderPageForms as $n => $f) {
14711 if ($shrink_f != 1) {
14712 $f[
'x'] = $x + (($f[
'x'] - $x) * $shrink_f);
14713 $f[
'y'] = $y + (($f[
'y'] - $y) * $shrink_f);
14714 $f[
'w'] *= $shrink_f;
14715 $f[
'h'] *= $shrink_f;
14716 $f[
'style'][
'fontsize'] *= $shrink_f;
14718 $this->form->forms[$f[
'n']] = $f;
14721 foreach ($this->HTMLheaderPageAnnots as $lk) {
14723 if ($rotate == 90) {
14724 $adjx = -($lk[
'x'] - $bbox_x) + ($preroth - ($lk[
'y'] - $bbox_y));
14725 $adjy = -($lk[
'y'] - $bbox_y) + ($lk[
'x'] - $bbox_x);
14726 } elseif ($rotate == -90) {
14727 $adjx = -($lk[
'x'] - $bbox_x) + ($lk[
'y'] - $bbox_y);
14728 $adjy = -($lk[
'y'] - $bbox_y) - ($lk[
'x'] - $bbox_x) + $prerotw;
14730 if ($rot_rpos !==
false) {
14731 $adjx += $prerotw - $preroth;
14733 if ($rot_bpos !==
false) {
14734 $adjy += $preroth - $prerotw;
14739 if ($shrink_f != 1) {
14740 $lk[
'x'] = $x + (($lk[
'x'] - $x) * $shrink_f);
14741 $lk[
'y'] = $y + (($lk[
'y'] - $y) * $shrink_f);
14743 $this->PageAnnots[$this->page][] = $lk;
14747 $this->headerbuffer =
'';
14748 $this->HTMLheaderPageLinks = [];
14749 $this->HTMLheaderPageAnnots = [];
14750 $this->HTMLheaderPageForms = [];
14751 $this->pageBackgrounds = $save_bgs;
14752 $this->writingHTMLheader =
false;
14754 $this->writingHTMLfooter =
false;
14755 $this->fullImageHeight =
false;
14756 $this->ResetMargins();
14757 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
14758 $this->SetXY($save_x, $save_y);
14759 $this->title2annots = $save_annots;
14760 $this->InFooter =
false;
14761 $this->pageoutput[$this->page] = [];
14762 $this->pageoutput[$this->page][
'Font'] =
'';
14765 $this->SetColumns($save_nbcol, $this->colvAlign, $this->ColGap);
14774 $blk[
'margin_top'] = 0;
14775 $blk[
'margin_left'] = 0;
14776 $blk[
'margin_bottom'] = 0;
14777 $blk[
'margin_right'] = 0;
14778 $blk[
'padding_top'] = 0;
14779 $blk[
'padding_left'] = 0;
14780 $blk[
'padding_bottom'] = 0;
14781 $blk[
'padding_right'] = 0;
14782 $blk[
'border_top'][
'w'] = 0;
14783 $blk[
'border_left'][
'w'] = 0;
14784 $blk[
'border_bottom'][
'w'] = 0;
14785 $blk[
'border_right'][
'w'] = 0;
14786 $blk[
'direction'] =
'ltr';
14787 $blk[
'hide'] =
false;
14788 $blk[
'outer_left_margin'] = 0;
14789 $blk[
'outer_right_margin'] = 0;
14790 $blk[
'cascadeCSS'] = [];
14791 $blk[
'block-align'] =
false;
14792 $blk[
'bgcolor'] =
false;
14793 $blk[
'page_break_after_avoid'] =
false;
14794 $blk[
'keep_block_together'] =
false;
14795 $blk[
'float'] =
false;
14796 $blk[
'line_height'] =
'';
14797 $blk[
'margin_collapse'] =
false;
14802 $prop = preg_split(
'/\s+/', trim($bd));
14804 if (isset($this->blk[$this->blklvl][
'inner_width'])) {
14805 $refw = $this->blk[$this->blklvl][
'inner_width'];
14806 } elseif (isset($this->blk[$this->blklvl - 1][
'inner_width'])) {
14807 $refw = $this->blk[$this->blklvl - 1][
'inner_width'];
14811 if (count($prop) == 1) {
14812 $bsize = $this->sizeConverter->convert($prop[0], $refw, $this->FontSize,
false);
14814 return [
's' => 1,
'w' => $bsize,
'c' => $this->colorConverter->convert(0, $this->PDFAXwarnings),
'style' =>
'solid'];
14816 return [
'w' => 0,
's' => 0];
14818 } elseif (count($prop) == 2) {
14820 if (in_array($prop[1], $this->borderstyles) || $prop[1] ==
'none' || $prop[1] ==
'hidden') {
14823 elseif (in_array($prop[0], $this->borderstyles) || $prop[0] ==
'none' || $prop[0] ==
'hidden') {
14825 $prop[1] = $prop[0];
14826 $prop[2] = $prop[1];
14830 $prop[2] = $prop[1];
14832 } elseif (count($prop) == 3) {
14834 if (substr($prop[0], 0, 1) ==
'#') {
14836 $prop[0] = $prop[1];
14837 $prop[1] = $prop[2];
14840 elseif (substr($prop[0], 1, 1) ==
'#') {
14842 $prop[0] = $prop[2];
14843 $prop[1] = $prop[0];
14846 elseif (in_array($prop[0], $this->borderstyles) || $prop[0] ==
'none' || $prop[0] ==
'hidden') {
14848 $prop[0] = $prop[1];
14852 return [
'w' => 0,
's' => 0];
14855 $bsize = $this->sizeConverter->convert($prop[0], $refw, $this->FontSize,
false);
14857 $coul = $this->colorConverter->convert($prop[2], $this->PDFAXwarnings);
14859 $prop[1] = strtolower($prop[1]);
14860 if (in_array($prop[1], $this->borderstyles) && $bsize > 0) {
14862 } elseif ($prop[1] ==
'hidden') {
14866 } elseif ($prop[1] ==
'none') {
14876 return [
's' => $on,
'w' => $bsize,
'c' => $coul,
'style' => $prop[1],
'dom' => 0];
14892 if (( (($x + $added) * ($x + $added)) / ($a * $a) + (($y + $added) * ($y + $added)) / ($b * $b) ) <= 1) {
14896 $t = atan2($y, $x);
14898 $newx = $b / sqrt((($b * $b) / ($a * $a)) + ( tan($t) * tan($t) ));
14899 $newy = $a / sqrt((($a * $a) / ($b * $b)) + ( (1 / tan($t)) * (1 / tan($t)) ));
14900 $px = max($px, $a - $newx + $added);
14901 $py = max($py, $b - $newy + $added);
14910 if ($oddEven ==
'E') {
14911 if ($this->directionality ==
'rtl') {
14917 if ($this->directionality ==
'rtl') {
14925 $p[
'SIZE'] =
'AUTO';
14928 $p[
'MARGIN-RIGHT'] = strval($this->orig_rMargin) .
'mm';
14929 $p[
'MARGIN-LEFT'] = strval($this->orig_lMargin) .
'mm';
14930 $p[
'MARGIN-TOP'] = strval($this->orig_tMargin) .
'mm';
14931 $p[
'MARGIN-BOTTOM'] = strval($this->orig_bMargin) .
'mm';
14932 $p[
'MARGIN-HEADER'] = strval($this->orig_hMargin) .
'mm';
14933 $p[
'MARGIN-FOOTER'] = strval($this->orig_fMargin) .
'mm';
14936 if (isset($this->cssManager->CSS[
'@PAGE'])) {
14937 $zp = $this->cssManager->CSS[
'@PAGE'];
14941 if (is_array($zp) && !empty($zp)) {
14942 $p = array_merge($p, $zp);
14945 if (isset($p[
'EVEN-HEADER-NAME']) && $oddEven ==
'E') {
14946 $p[
'HEADER'] = $p[
'EVEN-HEADER-NAME'];
14947 unset($p[
'EVEN-HEADER-NAME']);
14949 if (isset($p[
'ODD-HEADER-NAME']) && $oddEven !=
'E') {
14950 $p[
'HEADER'] = $p[
'ODD-HEADER-NAME'];
14951 unset($p[
'ODD-HEADER-NAME']);
14953 if (isset($p[
'EVEN-FOOTER-NAME']) && $oddEven ==
'E') {
14954 $p[
'FOOTER'] = $p[
'EVEN-FOOTER-NAME'];
14955 unset($p[
'EVEN-FOOTER-NAME']);
14957 if (isset($p[
'ODD-FOOTER-NAME']) && $oddEven !=
'E') {
14958 $p[
'FOOTER'] = $p[
'ODD-FOOTER-NAME'];
14959 unset($p[
'ODD-FOOTER-NAME']);
14963 if (isset($this->cssManager->CSS[
'@PAGE>>PSEUDO>>RIGHT']) && $side ==
'R') {
14964 $zp = $this->cssManager->CSS[
'@PAGE>>PSEUDO>>RIGHT'];
14968 if (isset($zp[
'SIZE'])) {
14969 unset($zp[
'SIZE']);
14971 if (isset($zp[
'SHEET-SIZE'])) {
14972 unset($zp[
'SHEET-SIZE']);
14975 if (isset($zp[
'MARGIN-LEFT'])) {
14976 unset($zp[
'MARGIN-LEFT']);
14978 if (isset($zp[
'MARGIN-RIGHT'])) {
14979 unset($zp[
'MARGIN-RIGHT']);
14981 if (is_array($zp) && !empty($zp)) {
14982 $p = array_merge($p, $zp);
14986 if (isset($this->cssManager->CSS[
'@PAGE>>PSEUDO>>LEFT']) && $side ==
'L') {
14987 $zp = $this->cssManager->CSS[
'@PAGE>>PSEUDO>>LEFT'];
14991 if (isset($zp[
'SIZE'])) {
14992 unset($zp[
'SIZE']);
14994 if (isset($zp[
'SHEET-SIZE'])) {
14995 unset($zp[
'SHEET-SIZE']);
14998 if (isset($zp[
'MARGIN-LEFT'])) {
14999 unset($zp[
'MARGIN-LEFT']);
15001 if (isset($zp[
'MARGIN-RIGHT'])) {
15002 unset($zp[
'MARGIN-RIGHT']);
15004 if (is_array($zp) && !empty($zp)) {
15005 $p = array_merge($p, $zp);
15009 if (isset($this->cssManager->CSS[
'@PAGE>>PSEUDO>>FIRST']) && $first) {
15010 $zp = $this->cssManager->CSS[
'@PAGE>>PSEUDO>>FIRST'];
15014 if (isset($zp[
'SIZE'])) {
15015 unset($zp[
'SIZE']);
15017 if (isset($zp[
'SHEET-SIZE'])) {
15018 unset($zp[
'SHEET-SIZE']);
15021 if (isset($zp[
'MARGIN-LEFT'])) {
15022 unset($zp[
'MARGIN-LEFT']);
15024 if (isset($zp[
'MARGIN-RIGHT'])) {
15025 unset($zp[
'MARGIN-RIGHT']);
15027 if (is_array($zp) && !empty($zp)) {
15028 $p = array_merge($p, $zp);
15033 if (isset($this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name])) {
15034 $zp = $this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name];
15038 if (is_array($zp) && !empty($zp)) {
15039 $p = array_merge($p, $zp);
15042 if (isset($p[
'EVEN-HEADER-NAME']) && $oddEven ==
'E') {
15043 $p[
'HEADER'] = $p[
'EVEN-HEADER-NAME'];
15044 unset($p[
'EVEN-HEADER-NAME']);
15046 if (isset($p[
'ODD-HEADER-NAME']) && $oddEven !=
'E') {
15047 $p[
'HEADER'] = $p[
'ODD-HEADER-NAME'];
15048 unset($p[
'ODD-HEADER-NAME']);
15050 if (isset($p[
'EVEN-FOOTER-NAME']) && $oddEven ==
'E') {
15051 $p[
'FOOTER'] = $p[
'EVEN-FOOTER-NAME'];
15052 unset($p[
'EVEN-FOOTER-NAME']);
15054 if (isset($p[
'ODD-FOOTER-NAME']) && $oddEven !=
'E') {
15055 $p[
'FOOTER'] = $p[
'ODD-FOOTER-NAME'];
15056 unset($p[
'ODD-FOOTER-NAME']);
15060 if (isset($this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name .
'>>PSEUDO>>RIGHT']) && $side ==
'R') {
15061 $zp = $this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name .
'>>PSEUDO>>RIGHT'];
15065 if (isset($zp[
'SIZE'])) {
15066 unset($zp[
'SIZE']);
15068 if (isset($zp[
'SHEET-SIZE'])) {
15069 unset($zp[
'SHEET-SIZE']);
15072 if (isset($zp[
'MARGIN-LEFT'])) {
15073 unset($zp[
'MARGIN-LEFT']);
15075 if (isset($zp[
'MARGIN-RIGHT'])) {
15076 unset($zp[
'MARGIN-RIGHT']);
15078 if (is_array($zp) && !empty($zp)) {
15079 $p = array_merge($p, $zp);
15083 if (isset($this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name .
'>>PSEUDO>>LEFT']) && $side ==
'L') {
15084 $zp = $this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name .
'>>PSEUDO>>LEFT'];
15088 if (isset($zp[
'SIZE'])) {
15089 unset($zp[
'SIZE']);
15091 if (isset($zp[
'SHEET-SIZE'])) {
15092 unset($zp[
'SHEET-SIZE']);
15095 if (isset($zp[
'MARGIN-LEFT'])) {
15096 unset($zp[
'MARGIN-LEFT']);
15098 if (isset($zp[
'MARGIN-RIGHT'])) {
15099 unset($zp[
'MARGIN-RIGHT']);
15101 if (is_array($zp) && !empty($zp)) {
15102 $p = array_merge($p, $zp);
15106 if (isset($this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name .
'>>PSEUDO>>FIRST']) && $first) {
15107 $zp = $this->cssManager->CSS[
'@PAGE>>NAMED>>' .
$name .
'>>PSEUDO>>FIRST'];
15111 if (isset($zp[
'SIZE'])) {
15112 unset($zp[
'SIZE']);
15114 if (isset($zp[
'SHEET-SIZE'])) {
15115 unset($zp[
'SHEET-SIZE']);
15118 if (isset($zp[
'MARGIN-LEFT'])) {
15119 unset($zp[
'MARGIN-LEFT']);
15121 if (isset($zp[
'MARGIN-RIGHT'])) {
15122 unset($zp[
'MARGIN-RIGHT']);
15124 if (is_array($zp) && !empty($zp)) {
15125 $p = array_merge($p, $zp);
15129 $orientation = $mgl = $mgr = $mgt = $mgb = $mgh = $mgf =
'';
15130 $header = $footer =
'';
15131 $resetpagenum = $pagenumstyle = $suppress =
'';
15138 if (isset($p[
'SHEET-SIZE']) && is_array($p[
'SHEET-SIZE'])) {
15139 $newformat = $p[
'SHEET-SIZE'];
15140 if ($newformat[0] > $newformat[1]) {
15141 $newformat = array_reverse($newformat);
15142 $p[
'ORIENTATION'] =
'L';
15144 $p[
'ORIENTATION'] =
'P';
15146 $this->_setPageSize($newformat, $p[
'ORIENTATION']);
15149 if (isset($p[
'SIZE']) && is_array($p[
'SIZE']) && !$newformat) {
15150 if ($p[
'SIZE'][
'W'] > $p[
'SIZE'][
'H']) {
15151 $p[
'ORIENTATION'] =
'L';
15153 $p[
'ORIENTATION'] =
'P';
15156 if (is_array($p[
'SIZE'])) {
15157 if ($p[
'SIZE'][
'W'] > $this->fw) {
15158 $p[
'SIZE'][
'W'] = $this->fw;
15160 if ($p[
'SIZE'][
'H'] > $this->fh) {
15161 $p[
'SIZE'][
'H'] = $this->fh;
15163 if (($p[
'ORIENTATION'] == $this->DefOrientation && !$newformat) || ($newformat && $p[
'ORIENTATION'] ==
'P')) {
15164 $outer_width_LR = ($this->fw - $p[
'SIZE'][
'W']) / 2;
15165 $outer_width_TB = ($this->fh - $p[
'SIZE'][
'H']) / 2;
15167 $outer_width_LR = ($this->fh - $p[
'SIZE'][
'W']) / 2;
15168 $outer_width_TB = ($this->fw - $p[
'SIZE'][
'H']) / 2;
15170 $pgw = $p[
'SIZE'][
'W'];
15171 $pgh = $p[
'SIZE'][
'H'];
15173 $outer_width_LR = 0;
15174 $outer_width_TB = 0;
15176 if (strtoupper($p[
'SIZE']) ==
'AUTO') {
15177 $p[
'ORIENTATION'] = $this->DefOrientation;
15178 } elseif (strtoupper($p[
'SIZE']) ==
'LANDSCAPE') {
15179 $p[
'ORIENTATION'] =
'L';
15181 $p[
'ORIENTATION'] =
'P';
15184 if (($p[
'ORIENTATION'] == $this->DefOrientation && !$newformat) || ($newformat && $p[
'ORIENTATION'] ==
'P')) {
15193 if (isset($p[
'HEADER']) && $p[
'HEADER']) {
15194 $header = $p[
'HEADER'];
15196 if (isset($p[
'FOOTER']) && $p[
'FOOTER']) {
15197 $footer = $p[
'FOOTER'];
15199 if (isset($p[
'RESETPAGENUM']) && $p[
'RESETPAGENUM']) {
15200 $resetpagenum = $p[
'RESETPAGENUM'];
15202 if (isset($p[
'PAGENUMSTYLE']) && $p[
'PAGENUMSTYLE']) {
15203 $pagenumstyle = $p[
'PAGENUMSTYLE'];
15205 if (isset($p[
'SUPPRESS']) && $p[
'SUPPRESS']) {
15206 $suppress = $p[
'SUPPRESS'];
15209 if (isset($p[
'MARKS'])) {
15210 if (preg_match(
'/cross/i', $p[
'MARKS']) && preg_match(
'/crop/i', $p[
'MARKS'])) {
15211 $marks =
'CROPCROSS';
15212 } elseif (strtoupper($p[
'MARKS']) ==
'CROP') {
15214 } elseif (strtoupper($p[
'MARKS']) ==
'CROSS') {
15219 if (isset($p[
'BACKGROUND-COLOR']) && $p[
'BACKGROUND-COLOR']) {
15220 $bg[
'BACKGROUND-COLOR'] = $p[
'BACKGROUND-COLOR'];
15223 if (isset($p[
'BACKGROUND-GRADIENT']) && $p[
'BACKGROUND-GRADIENT']) {
15224 $bg[
'BACKGROUND-GRADIENT'] = $p[
'BACKGROUND-GRADIENT'];
15226 if (isset($p[
'BACKGROUND-IMAGE']) && $p[
'BACKGROUND-IMAGE']) {
15227 $bg[
'BACKGROUND-IMAGE'] = $p[
'BACKGROUND-IMAGE'];
15229 if (isset($p[
'BACKGROUND-REPEAT']) && $p[
'BACKGROUND-REPEAT']) {
15230 $bg[
'BACKGROUND-REPEAT'] = $p[
'BACKGROUND-REPEAT'];
15232 if (isset($p[
'BACKGROUND-POSITION']) && $p[
'BACKGROUND-POSITION']) {
15233 $bg[
'BACKGROUND-POSITION'] = $p[
'BACKGROUND-POSITION'];
15235 if (isset($p[
'BACKGROUND-IMAGE-RESIZE']) && $p[
'BACKGROUND-IMAGE-RESIZE']) {
15236 $bg[
'BACKGROUND-IMAGE-RESIZE'] = $p[
'BACKGROUND-IMAGE-RESIZE'];
15238 if (isset($p[
'BACKGROUND-IMAGE-OPACITY'])) {
15239 $bg[
'BACKGROUND-IMAGE-OPACITY'] = $p[
'BACKGROUND-IMAGE-OPACITY'];
15243 if (isset($p[
'MARGIN-LEFT'])) {
15244 $mgl = $this->sizeConverter->convert($p[
'MARGIN-LEFT'], $pgw) + $outer_width_LR;
15246 if (isset($p[
'MARGIN-RIGHT'])) {
15247 $mgr = $this->sizeConverter->convert($p[
'MARGIN-RIGHT'], $pgw) + $outer_width_LR;
15249 if (isset($p[
'MARGIN-BOTTOM'])) {
15250 $mgb = $this->sizeConverter->convert($p[
'MARGIN-BOTTOM'], $pgh) + $outer_width_TB;
15252 if (isset($p[
'MARGIN-TOP'])) {
15253 $mgt = $this->sizeConverter->convert($p[
'MARGIN-TOP'], $pgh) + $outer_width_TB;
15255 if (isset($p[
'MARGIN-HEADER'])) {
15256 $mgh = $this->sizeConverter->convert($p[
'MARGIN-HEADER'], $pgh) + $outer_width_TB;
15258 if (isset($p[
'MARGIN-FOOTER'])) {
15259 $mgf = $this->sizeConverter->convert($p[
'MARGIN-FOOTER'], $pgh) + $outer_width_TB;
15262 if (isset($p[
'ORIENTATION']) && $p[
'ORIENTATION']) {
15263 $orientation = $p[
'ORIENTATION'];
15265 $this->page_box[
'outer_width_LR'] = $outer_width_LR;
15266 $this->page_box[
'outer_width_TB'] = $outer_width_TB;
15268 return [$orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $header, $footer, $bg, $resetpagenum, $pagenumstyle, $suppress, $marks, $newformat];
15280 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($blklvl,
true);
15281 $end = $currpos = ($this->page * 1000 + $this->y);
15282 if ($clear ==
'BOTH' && ($l_exists || $r_exists)) {
15283 $this->pageoutput[$this->page] = [];
15284 $end = max($l_max, $r_max, $currpos);
15285 } elseif ($clear ==
'RIGHT' && $r_exists) {
15286 $this->pageoutput[$this->page] = [];
15287 $end = max($r_max, $currpos);
15288 } elseif ($clear ==
'LEFT' && $l_exists) {
15289 $this->pageoutput[$this->page] = [];
15290 $end = max($l_max, $currpos);
15294 $old_page = $this->page;
15295 $new_page = intval($end / 1000);
15296 if ($old_page != $new_page) {
15297 $s = $this->PrintPageBackgrounds();
15299 $this->pages[$this->page] = preg_replace(
'/(___BACKGROUND___PATTERNS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->pages[$this->page]);
15300 $this->pageBackgrounds = [];
15301 $this->page = $new_page;
15303 $this->ResetMargins();
15304 $this->pageoutput[$this->page] = [];
15306 $this->y = (round($end * 1000) % 1000000) / 1000;
15319 if (count($this->floatDivs)) {
15320 $currpos = ($this->page * 1000 + $this->y);
15321 foreach ($this->floatDivs as $f) {
15322 if (($clear && $f[
'blockContext'] == $this->blk[$blklvl][
'blockContext']) || (!$clear && $currpos >= $f[
'startpos'] && $currpos < ($f[
'endpos'] - 0.001) && $f[
'blklvl'] > $blklvl && $f[
'blockContext'] == $this->blk[$blklvl][
'blockContext'])) {
15323 if ($f[
'side'] ==
'L') {
15325 $l_max = max($l_max, $f[
'endpos']);
15326 $l_width = max($l_width, $f[
'w']);
15328 if ($f[
'side'] ==
'R') {
15330 $r_max = max($r_max, $f[
'endpos']);
15331 $r_width = max($r_width, $f[
'w']);
15336 return [$l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width];
15347 $this->listitem =
'';
15350 if ($listitemimage && $listitemimage !=
'none') {
15351 $listitemimage = trim(preg_replace(
'/url\(["\']*(.*?)["\']*\)/',
'\\1', $listitemimage));
15358 $objattr[
'margin_top'] = 0;
15359 $objattr[
'margin_bottom'] = 0;
15360 $objattr[
'margin_left'] = 0;
15361 $objattr[
'margin_right'] = 0;
15362 $objattr[
'padding_top'] = 0;
15363 $objattr[
'padding_bottom'] = 0;
15364 $objattr[
'padding_left'] = 0;
15365 $objattr[
'padding_right'] = 0;
15366 $objattr[
'width'] = 0;
15367 $objattr[
'height'] = 0;
15368 $objattr[
'border_top'][
'w'] = 0;
15369 $objattr[
'border_bottom'][
'w'] = 0;
15370 $objattr[
'border_left'][
'w'] = 0;
15371 $objattr[
'border_right'][
'w'] = 0;
15372 $objattr[
'visibility'] =
'visible';
15373 $srcpath = $listitemimage;
15374 $orig_srcpath = $listitemimage;
15376 $objattr[
'vertical-align'] =
'BS';
15381 $info = $this->imageProcessor->getImage($srcpath,
true,
true, $orig_srcpath);
15386 if ($info[
'w'] == 0 && $info[
'h'] == 0) {
15387 $info[
'h'] = $this->sizeConverter->convert(
'1em', $this->blk[$this->blklvl][
'inner_width'], $this->FontSize,
false);
15390 $objattr[
'file'] = $srcpath;
15393 if ($w == 0 and $h == 0) {
15395 if ($info[
'type'] ==
'wmf') {
15399 $w = abs($info[
'w']) / (20 * Mpdf::SCALE);
15400 $h = abs($info[
'h']) / (20 * Mpdf::SCALE);
15402 if ($info[
'type'] ==
'svg') {
15404 $w = abs($info[
'w']) / Mpdf::SCALE;
15405 $h = abs($info[
'h']) / Mpdf::SCALE;
15408 $w = ($info[
'w'] / Mpdf::SCALE) * (72 / $this->img_dpi);
15409 $h = ($info[
'h'] / Mpdf::SCALE) * (72 / $this->img_dpi);
15415 $w = abs($h * $info[
'w'] / $info[
'h']);
15418 $h = abs($w * $info[
'h'] / $info[
'w']);
15421 if ($w > $maxWidth) {
15423 $h = abs($w * $info[
'h'] / $info[
'w']);
15426 if ($h > $maxHeight) {
15428 $w = abs($h * $info[
'w'] / $info[
'h']);
15431 $objattr[
'type'] =
'image';
15432 $objattr[
'itype'] = $info[
'type'];
15434 $objattr[
'orig_h'] = $info[
'h'];
15435 $objattr[
'orig_w'] = $info[
'w'];
15438 if ($info[
'type'] ==
'wmf') {
15439 $objattr[
'wmf_x'] = $info[
'x'];
15440 $objattr[
'wmf_y'] = $info[
'y'];
15442 if ($info[
'type'] ==
'svg') {
15443 $objattr[
'wmf_x'] = $info[
'x'];
15444 $objattr[
'wmf_y'] = $info[
'y'];
15448 $objattr[
'height'] = $h;
15449 $objattr[
'width'] = $w;
15450 $objattr[
'image_height'] = $h;
15451 $objattr[
'image_width'] = $w;
15453 $objattr[
'dir'] = (isset($this->blk[$this->blklvl][
'direction']) ? $this->blk[$this->blklvl][
'direction'] :
'ltr');
15454 $objattr[
'listmarker'] =
true;
15456 $objattr[
'listmarkerposition'] = $listitemposition;
15458 $e =
"\xbb\xa4\xactype=image,objattr=" . serialize($objattr) .
"\xbb\xa4\xac";
15459 $this->_saveTextBuffer($e);
15461 if ($listitemposition ==
'inside') {
15463 $this->_saveTextBuffer($e);
15465 } elseif ($listitemtype ==
'disc' || $listitemtype ==
'circle' || $listitemtype ==
'square') {
15467 $objattr[
'type'] =
'listmarker';
15468 $objattr[
'listmarkerposition'] = $listitemposition;
15469 $objattr[
'width'] = 0;
15470 $size = $this->sizeConverter->convert($this->list_symbol_size, $this->FontSize);
15471 $objattr[
'size'] = $size;
15472 $objattr[
'offset'] = $this->sizeConverter->convert($this->list_marker_offset, $this->FontSize);
15474 if ($listitemposition ==
'inside') {
15475 $objattr[
'width'] = $size + $objattr[
'offset'];
15478 $objattr[
'height'] = $this->FontSize;
15479 $objattr[
'vertical-align'] =
'T';
15480 $objattr[
'text'] =
'';
15481 $objattr[
'dir'] = (isset($this->blk[$this->blklvl][
'direction']) ? $this->blk[$this->blklvl][
'direction'] :
'ltr');
15482 $objattr[
'bullet'] = $listitemtype;
15483 $objattr[
'colorarray'] = $this->colorarray;
15484 $objattr[
'fontfamily'] = $this->FontFamily;
15485 $objattr[
'fontsize'] = $this->FontSize;
15486 $objattr[
'fontsizept'] = $this->FontSizePt;
15487 $objattr[
'fontstyle'] = $this->FontStyle;
15489 $e =
"\xbb\xa4\xactype=listmarker,objattr=" . serialize($objattr) .
"\xbb\xa4\xac";
15490 $this->listitem = $this->_saveTextBuffer($e,
'',
'',
true);
15492 } elseif (preg_match(
'/U\+([a-fA-F0-9]+)/i', $listitemtype, $m)) {
15494 if ($this->_charDefined($this->CurrentFont[
'cw'], hexdec($m[1]))) {
15497 $list_item_marker =
'-';
15499 if (preg_match(
'/rgb\(.*?\)/', $listitemtype, $m)) {
15500 $list_item_color = $this->colorConverter->convert($m[0], $this->PDFAXwarnings);
15502 $list_item_color =
'';
15506 $save_colorarray = $this->colorarray;
15507 if ($list_item_color) {
15508 $this->colorarray = $list_item_color;
15511 if ($listitemposition ==
'inside') {
15512 $e = $list_item_marker . $spacer;
15513 $this->_saveTextBuffer($e);
15516 $objattr[
'type'] =
'listmarker';
15517 $objattr[
'width'] = 0;
15518 $objattr[
'height'] = $this->FontSize;
15519 $objattr[
'vertical-align'] =
'T';
15520 $objattr[
'text'] = $list_item_marker;
15521 $objattr[
'dir'] = (isset($this->blk[$this->blklvl][
'direction']) ? $this->blk[$this->blklvl][
'direction'] :
'ltr');
15522 $objattr[
'colorarray'] = $this->colorarray;
15523 $objattr[
'fontfamily'] = $this->FontFamily;
15524 $objattr[
'fontsize'] = $this->FontSize;
15525 $objattr[
'fontsizept'] = $this->FontSizePt;
15526 $objattr[
'fontstyle'] = $this->FontStyle;
15527 $e =
"\xbb\xa4\xactype=listmarker,objattr=" . serialize($objattr) .
"\xbb\xa4\xac";
15528 $this->listitem = $this->_saveTextBuffer($e,
'',
'',
true);
15532 $this->colorarray = $save_colorarray;
15535 $counter = $this->listcounter[$this->listlvl];
15537 if ($listitemtype ==
'none') {
15541 $num = $this->_getStyledNumber($counter, $listitemtype,
true);
15543 if ($listitemposition ==
'inside') {
15544 $e = $num . $this->list_number_suffix . $spacer;
15545 $this->_saveTextBuffer($e);
15547 if (isset($this->blk[$this->blklvl][
'direction']) && $this->blk[$this->blklvl][
'direction'] ==
'rtl') {
15549 $m = strtr($this->list_number_suffix,
")]}",
"([{") . $num;
15551 $m = $num . $this->list_number_suffix;
15555 $objattr[
'type'] =
'listmarker';
15556 $objattr[
'width'] = 0;
15557 $objattr[
'height'] = $this->FontSize;
15558 $objattr[
'vertical-align'] =
'T';
15559 $objattr[
'text'] = $m;
15560 $objattr[
'dir'] = (isset($this->blk[$this->blklvl][
'direction']) ? $this->blk[$this->blklvl][
'direction'] :
'ltr');
15561 $objattr[
'colorarray'] = $this->colorarray;
15562 $objattr[
'fontfamily'] = $this->FontFamily;
15563 $objattr[
'fontsize'] = $this->FontSize;
15564 $objattr[
'fontsizept'] = $this->FontSizePt;
15565 $objattr[
'fontstyle'] = $this->FontStyle;
15566 $e =
"\xbb\xa4\xactype=listmarker,objattr=" . serialize($objattr) .
"\xbb\xa4\xac";
15568 $this->listitem = $this->_saveTextBuffer($e,
'',
'',
true);
15578 $markeroffset = $this->sizeConverter->convert($this->list_marker_offset, $this->FontSize);
15581 $maxnum = $this->listcounter[$this->listlvl];
15582 if ($currblk[
'list_style_type'] !=
'disc' && $currblk[
'list_style_type'] !=
'circle' && $currblk[
'list_style_type'] !=
'square') {
15584 for ($j = $i + 2; $j < count($a); $j+=2) {
15589 if ($e[0] ==
'/') {
15590 $e = strtoupper(substr($e, 1));
15591 if ($e ==
'OL' || $e ==
'UL') {
15598 if (strpos($e,
' ')) {
15599 $e = substr($e, 0, strpos($e,
' '));
15601 $e = strtoupper($e);
15606 } elseif ($e ==
'OL' || $e ==
'UL') {
15617 switch ($currblk[
'list_style_type']) {
15620 $blt_width = $this->GetStringWidth(str_repeat(
'5', strlen($maxnum)) . $this->list_number_suffix);
15625 case 'upper-alpha':
15626 case 'upper-latin':
15628 $maxnumA = $decToAlpha->convert($maxnum,
true);
15629 if ($maxnum < 13) {
15630 $blt_width = $this->GetStringWidth(
'D' . $this->list_number_suffix);
15632 $blt_width = $this->GetStringWidth(str_repeat(
'W', strlen($maxnumA)) . $this->list_number_suffix);
15635 case 'lower-alpha':
15636 case 'lower-latin':
15638 $maxnuma = $decToAlpha->convert($maxnum,
false);
15639 if ($maxnum < 13) {
15640 $blt_width = $this->GetStringWidth(
'b' . $this->list_number_suffix);
15642 $blt_width = $this->GetStringWidth(str_repeat(
'm', strlen($maxnuma)) . $this->list_number_suffix);
15645 case 'upper-roman':
15647 if ($maxnum > 87) {
15649 } elseif ($maxnum > 86) {
15651 } elseif ($maxnum > 37) {
15653 } elseif ($maxnum > 36) {
15655 } elseif ($maxnum > 27) {
15657 } elseif ($maxnum > 26) {
15659 } elseif ($maxnum > 17) {
15661 } elseif ($maxnum > 16) {
15663 } elseif ($maxnum > 7) {
15665 } elseif ($maxnum > 6) {
15667 } elseif ($maxnum > 3) {
15673 $maxlnum = $decToRoman->convert($bbit,
true);
15674 $blt_width = $this->GetStringWidth($maxlnum . $this->list_number_suffix);
15677 case 'lower-roman':
15679 if ($maxnum > 87) {
15681 } elseif ($maxnum > 86) {
15683 } elseif ($maxnum > 37) {
15685 } elseif ($maxnum > 36) {
15687 } elseif ($maxnum > 27) {
15689 } elseif ($maxnum > 26) {
15691 } elseif ($maxnum > 17) {
15693 } elseif ($maxnum > 16) {
15695 } elseif ($maxnum > 7) {
15697 } elseif ($maxnum > 6) {
15699 } elseif ($maxnum > 3) {
15704 $maxlnum = $decToRoman->convert($bbit,
false);
15705 $blt_width = $this->GetStringWidth($maxlnum . $this->list_number_suffix);
15711 $size = $this->sizeConverter->convert($this->list_symbol_size, $this->FontSize);
15712 $offset = $this->sizeConverter->convert($this->list_marker_offset, $this->FontSize);
15713 $blt_width = $size + $offset;
15716 case 'arabic-indic':
15717 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0660), strlen($maxnum)) . $this->list_number_suffix);
15721 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x06F0), strlen($maxnum)) . $this->list_number_suffix);
15724 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x09E6), strlen($maxnum)) . $this->list_number_suffix);
15727 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0966), strlen($maxnum)) . $this->list_number_suffix);
15730 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0AE6), strlen($maxnum)) . $this->list_number_suffix);
15733 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0A66), strlen($maxnum)) . $this->list_number_suffix);
15736 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0CE6), strlen($maxnum)) . $this->list_number_suffix);
15739 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(6, 0x0D66), strlen($maxnum)) . $this->list_number_suffix);
15742 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0B66), strlen($maxnum)) . $this->list_number_suffix);
15745 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(3, 0x0C66), strlen($maxnum)) . $this->list_number_suffix);
15748 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(9, 0x0BE6), strlen($maxnum)) . $this->list_number_suffix);
15751 $blt_width = $this->GetStringWidth(str_repeat($decToOther->convert(5, 0x0E50), strlen($maxnum)) . $this->list_number_suffix);
15754 $blt_width = $this->GetStringWidth(str_repeat(
'5', strlen($maxnum)) . $this->list_number_suffix);
15758 return ($blt_width + $markeroffset);
15766 if (isset($link) && $link) {
15769 $arr[2] = $this->currentfontstyle;
15770 if (isset($this->colorarray) && $this->colorarray) {
15771 $arr[3] = $this->colorarray;
15773 $arr[4] = $this->currentfontfamily;
15774 $arr[5] = $this->currentLang;
15775 if (isset($intlink) && $intlink) {
15776 $arr[7] = $intlink;
15782 if (isset($this->OTLtags[
'Plus']) && strpos($this->OTLtags[
'Plus'],
'kern') !==
false && empty($this->OTLdata[
'GPOSinfo'])) {
15785 $arr[8] = $this->textvar;
15786 if (isset($this->textparam) && $this->textparam) {
15787 $arr[9] = $this->textparam;
15789 if (isset($this->spanbgcolorarray) && $this->spanbgcolorarray) {
15790 $arr[10] = $this->spanbgcolorarray;
15792 $arr[11] = $this->currentfontsize;
15793 if (isset($this->ReqFontStyle) && $this->ReqFontStyle) {
15794 $arr[12] = $this->ReqFontStyle;
15796 if (isset($this->lSpacingCSS) && $this->lSpacingCSS) {
15797 $arr[14] = $this->lSpacingCSS;
15799 if (isset($this->wSpacingCSS) && $this->wSpacingCSS) {
15800 $arr[15] = $this->wSpacingCSS;
15802 if (isset($this->spanborddet) && $this->spanborddet) {
15803 $arr[16] = $this->spanborddet;
15805 if (isset($this->textshadow) && $this->textshadow) {
15806 $arr[17] = $this->textshadow;
15808 if (isset($this->OTLdata) && $this->OTLdata) {
15809 $arr[18] = $this->OTLdata;
15810 $this->OTLdata = [];
15819 if ($this->listitem) {
15820 $this->textbuffer[] = $this->listitem;
15821 $this->listitem = [];
15823 $this->textbuffer[] = $arr;
15830 if (isset($link) && $link) {
15833 $arr[2] = $this->currentfontstyle;
15834 if (isset($this->colorarray) && $this->colorarray) {
15835 $arr[3] = $this->colorarray;
15837 $arr[4] = $this->currentfontfamily;
15838 if (isset($intlink) && $intlink) {
15839 $arr[7] = $intlink;
15845 if (isset($this->OTLtags[
'Plus']) && strpos($this->OTLtags[
'Plus'],
'kern') !==
false && empty($this->OTLdata[
'GPOSinfo'])) {
15848 $arr[8] = $this->textvar;
15849 if (isset($this->textparam) && $this->textparam) {
15850 $arr[9] = $this->textparam;
15852 if (isset($this->spanbgcolorarray) && $this->spanbgcolorarray) {
15853 $arr[10] = $this->spanbgcolorarray;
15855 $arr[11] = $this->currentfontsize;
15856 if (isset($this->ReqFontStyle) && $this->ReqFontStyle) {
15857 $arr[12] = $this->ReqFontStyle;
15859 if (isset($this->lSpacingCSS) && $this->lSpacingCSS) {
15860 $arr[14] = $this->lSpacingCSS;
15862 if (isset($this->wSpacingCSS) && $this->wSpacingCSS) {
15863 $arr[15] = $this->wSpacingCSS;
15865 if (isset($this->spanborddet) && $this->spanborddet) {
15866 $arr[16] = $this->spanborddet;
15868 if (isset($this->textshadow) && $this->textshadow) {
15869 $arr[17] = $this->textshadow;
15871 if (isset($this->OTLdata) && $this->OTLdata) {
15872 $arr[18] = $this->OTLdata;
15873 $this->OTLdata = [];
15878 $this->cell[$this->row][$this->col][
'textbuffer'][] = $arr;
15881 function printbuffer($arrayaux, $blockstate = 0, $is_table =
false, $table_draft =
false, $cell_dir =
'')
15887 $this->spanbgcolorarray =
'';
15888 $this->spanbgcolor =
false;
15889 $this->spanborder =
false;
15890 $this->spanborddet = [];
15891 $paint_ht_corr = 0;
15893 if (count($this->floatDivs)) {
15894 list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($this->blklvl);
15895 if (($this->blk[$this->blklvl][
'inner_width'] - $l_width - $r_width) < (2 * $this->GetCharWidth(
'W',
false))) {
15897 if ($l_max < $r_max && ($this->blk[$this->blklvl][
'inner_width'] - $r_width) > (2 * $this->GetCharWidth(
'W',
false))) {
15898 $this->ClearFloats(
'LEFT', $this->blklvl);
15899 } elseif ($r_max < $l_max && ($this->blk[$this->blklvl][
'inner_width'] - $l_width) > (2 * $this->GetCharWidth(
'W',
false))) {
15900 $this->ClearFloats(
'RIGHT', $this->blklvl);
15902 $this->ClearFloats(
'BOTH', $this->blklvl);
15911 if (isset($this->blk[$this->blklvl][
'align']) && $this->blk[$this->blklvl][
'align']) {
15912 $align = $this->blk[$this->blklvl][
'align'];
15915 if (isset($this->blk[$this->blklvl][
'block-align']) && $this->blk[$this->blklvl][
'block-align']) {
15916 $align = $this->blk[$this->blklvl][
'block-align'];
15918 if (isset($this->blk[$this->blklvl][
'direction'])) {
15919 $blockdir = $this->blk[$this->blklvl][
'direction'];
15923 $this->divwidth = $this->blk[$this->blklvl][
'width'];
15925 $align = $this->cellTextAlign;
15926 $blockdir = $cell_dir;
15928 $oldpage = $this->page;
15931 if ($this->divwidth == 0) {
15932 $this->divwidth = $this->pgwidth;
15936 $this->SetLineHeight($this->FontSizePt, $this->blk[$this->blklvl][
'line_height']);
15938 $this->divheight = $this->lineheight;
15939 $old_height = $this->divheight;
15942 if (!$table_draft) {
15943 $this->
SetFont($this->default_font,
'', $this->default_font_size,
true,
true);
15946 $this->newFlowingBlock($this->divwidth, $this->divheight, $align, $is_table, $blockstate,
true, $blockdir, $table_draft);
15948 $array_size = count($arrayaux);
15951 if ($array_size == 0) {
15952 $this->finishFlowingBlock(
true);
15957 for ($i = 0; $i < $array_size; $i++) {
15958 if (empty($arrayaux[$i][18])) {
15959 if (substr($arrayaux[$i][0], 0, 3) ==
"\xbb\xa4\xac") {
15960 $unicode = [0xFFFC];
15962 $unicode = $this->UTF8StringToArray($arrayaux[$i][0],
false);
15964 $is_strong =
false;
15965 $this->getBasicOTLdata($arrayaux[$i][18], $unicode, $is_strong);
15968 if (($blockdir ==
'rtl' || $this->biDirectional) && isset($arrayaux[$i][4]) && in_array($arrayaux[$i][4], [
'ccourier',
'ctimes',
'chelvetica',
'csymbol',
'czapfdingbats'])) {
15969 throw new \Mpdf\MpdfException(
"You cannot use core fonts in a document which contains RTL text.");
15974 if (($blockdir ==
'rtl' || $this->biDirectional) && !$table_draft) {
15975 if (empty($this->otl)) {
15976 $this->otl =
new Otl($this, $this->fontCache);
15978 $this->otl->bidiPrepare($arrayaux, $blockdir);
15979 $array_size = count($arrayaux);
15984 for ($i = $array_size - 1; $i > 0; $i--) {
15985 if (empty($arrayaux[$i][0]) && (isset($arrayaux[$i][16]) && $arrayaux[$i][16] !==
'0') && empty($arrayaux[$i][7])) {
15986 unset($arrayaux[$i]);
15991 if (isset($arrayaux[0][16])) {
15992 $lastspanborder = $arrayaux[0][16];
15994 $lastspanborder =
false;
15996 for ($i = 1; $i < $array_size; $i++) {
15997 if (isset($arrayaux[$i][16]) && $arrayaux[$i][16] == $lastspanborder &&
15998 ((!isset($arrayaux[$i][9][
'bord-decoration']) && !isset($arrayaux[$i - 1][9][
'bord-decoration'])) ||
15999 (isset($arrayaux[$i][9][
'bord-decoration']) && isset($arrayaux[$i - 1][9][
'bord-decoration']) && $arrayaux[$i][9][
'bord-decoration'] == $arrayaux[$i - 1][9][
'bord-decoration'])
16002 if (isset($arrayaux[$i][16][
'R'])) {
16003 $lastspanborder = $arrayaux[$i][16];
16005 $lastspanborder =
false;
16007 $arrayaux[$i][16][
'L'][
's'] = 0;
16008 $arrayaux[$i][16][
'L'][
'w'] = 0;
16009 $arrayaux[$i - 1][16][
'R'][
's'] = 0;
16010 $arrayaux[$i - 1][16][
'R'][
'w'] = 0;
16012 if (isset($arrayaux[$i][16][
'R'])) {
16013 $lastspanborder = $arrayaux[$i][16];
16015 $lastspanborder =
false;
16020 for ($i = 0; $i < $array_size; $i++) {
16022 $oldcolumn = $this->CurrCol;
16023 $vetor = isset($arrayaux[$i]) ? $arrayaux[$i] :
null;
16024 if ($i == 0 && $vetor[0] !=
"\n" && ! $this->ispre) {
16025 $vetor[0] = ltrim($vetor[0]);
16026 if (!empty($vetor[18])) {
16027 $this->otl->trimOTLdata($vetor[18],
true,
false);
16032 if (empty($vetor[0]) && !($vetor[0] ===
'0') && empty($vetor[7])) {
16034 if ($i == ($array_size - 1)) {
16035 $this->finishFlowingBlock(
true);
16042 if (isset($vetor[11]) && $vetor[11] !=
'') {
16043 if ($is_table && $this->shrin_k) {
16044 $this->
SetFontSize($vetor[11] / $this->shrin_k,
false);
16050 if (isset($vetor[17]) && !empty($vetor[17])) {
16051 $this->textshadow = $vetor[17];
16053 if (isset($vetor[16]) && !empty($vetor[16])) {
16054 $this->spanborddet = $vetor[16];
16055 $this->spanborder =
true;
16058 if (isset($vetor[15])) {
16059 $this->wSpacingCSS = $vetor[15];
16060 if ($this->wSpacingCSS && strtoupper($this->wSpacingCSS) !=
'NORMAL') {
16061 $this->minwSpacing = $this->sizeConverter->convert($this->wSpacingCSS, $this->FontSize) / $this->shrin_k;
16064 if (isset($vetor[14])) {
16065 $this->lSpacingCSS = $vetor[14];
16066 if (($this->lSpacingCSS || $this->lSpacingCSS ===
'0') && strtoupper($this->lSpacingCSS) !=
'NORMAL') {
16067 $this->fixedlSpacing = $this->sizeConverter->convert($this->lSpacingCSS, $this->FontSize) / $this->shrin_k;
16072 if (isset($vetor[10]) and ! empty($vetor[10])) {
16073 $this->spanbgcolorarray = $vetor[10];
16074 $this->spanbgcolor =
true;
16076 if (isset($vetor[9]) and ! empty($vetor[9])) {
16077 $this->textparam = $vetor[9];
16078 $this->SetTextOutline($this->textparam);
16080 if ($is_table && $this->shrin_k) {
16081 if (isset($this->textparam[
'text-baseline'])) {
16082 $this->textparam[
'text-baseline'] /= $this->shrin_k;
16084 if (isset($this->textparam[
'decoration-baseline'])) {
16085 $this->textparam[
'decoration-baseline'] /= $this->shrin_k;
16087 if (isset($this->textparam[
'decoration-fontsize'])) {
16088 $this->textparam[
'decoration-fontsize'] /= $this->shrin_k;
16092 if (isset($vetor[8])) {
16093 $this->textvar = $vetor[8];
16095 if (isset($vetor[7]) and $vetor[7] !=
'') {
16097 if ($this->table_rotate) {
16098 $this->internallink[$vetor[7]] = [
"Y" => $ily,
"PAGE" => $this->page,
"tbrot" =>
true];
16099 } elseif ($this->kwt) {
16100 $this->internallink[$vetor[7]] = [
"Y" => $ily,
"PAGE" => $this->page,
"kwt" =>
true];
16101 } elseif ($this->ColActive) {
16102 $this->internallink[$vetor[7]] = [
"Y" => $ily,
"PAGE" => $this->page,
"col" => $this->CurrCol];
16103 } elseif (!$this->keep_block_together) {
16104 $this->internallink[$vetor[7]] = [
"Y" => $ily,
"PAGE" => $this->page];
16106 if (empty($vetor[0])) {
16108 if ($i == ($array_size - 1)) {
16109 $this->finishFlowingBlock(
true);
16114 if (isset($vetor[5]) and $vetor[5] !=
'') {
16115 $this->currentLang = $vetor[5];
16117 if (isset($vetor[4]) and $vetor[4] !=
'') {
16118 $font = $this->
SetFont($vetor[4], $this->FontStyle, 0,
false);
16120 if (!empty($vetor[3])) {
16122 $this->SetTColor($cor);
16124 if (isset($vetor[2]) and $vetor[2] !=
'') {
16125 $this->SetStyles($vetor[2]);
16128 if (isset($vetor[12]) and $vetor[12] !=
'') {
16129 $this->ReqFontStyle = $vetor[12];
16131 if (isset($vetor[1]) and $vetor[1] !=
'') {
16132 if (strpos($vetor[1],
".") ===
false && strpos($vetor[1],
"@") !== 0) {
16134 while (array_key_exists($vetor[1], $this->internallink)) {
16135 $vetor[1] =
"#" . $vetor[1];
16137 $this->internallink[$vetor[1]] = $this->AddLink();
16138 $vetor[1] = $this->internallink[$vetor[1]];
16140 $this->HREF = $vetor[1];
16146 if (substr($vetor[0], 0, 3) ==
"\xbb\xa4\xac") {
16147 $objattr = $this->_getObjAttr($vetor[0]);
16150 if ($objattr[
'type'] ==
'nestedtable') {
16151 if ($objattr[
'nestedcontent']) {
16152 $level = $objattr[
'level'];
16153 $table = &$this->table[$level][$objattr[
'table']];
16155 if ($table_draft) {
16156 $this->y += $this->table[($level + 1)][$objattr[
'nestedcontent']][
'h'];
16157 $this->finishFlowingBlock(
false,
'nestedtable');
16159 $cell = &$table[
'cells'][$objattr[
'row']][$objattr[
'col']];
16160 $this->finishFlowingBlock(
false,
'nestedtable');
16161 $save_dw = $this->divwidth;
16162 $save_buffer = $this->cellBorderBuffer;
16163 $this->cellBorderBuffer = [];
16165 list($dummyx, $w) = $this->_tableGetWidth($table, $objattr[
'row'], $objattr[
'col']);
16166 $ntw = $this->table[($level + 1)][$objattr[
'nestedcontent']][
'w'];
16167 if (!$this->simpleTables) {
16168 if ($this->packTableData) {
16169 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($cell[
'borderbin']);
16171 $br = $cell[
'border_details'][
'R'][
'w'];
16172 $bl = $cell[
'border_details'][
'L'][
'w'];
16174 if ($table[
'borders_separate']) {
16175 $innerw = $w - $bl - $br - $cell[
'padding'][
'L'] - $cell[
'padding'][
'R'] - $table[
'border_spacing_H'];
16177 $innerw = $w - $bl / 2 - $br / 2 - $cell[
'padding'][
'L'] - $cell[
'padding'][
'R'];
16179 } elseif ($this->simpleTables) {
16180 if ($table[
'borders_separate']) {
16181 $innerw = $w - $table[
'simple'][
'border_details'][
'L'][
'w'] - $table[
'simple'][
'border_details'][
'R'][
'w'] - $cell[
'padding'][
'L'] - $cell[
'padding'][
'R'] - $table[
'border_spacing_H'];
16183 $innerw = $w - $table[
'simple'][
'border_details'][
'L'][
'w'] / 2 - $table[
'simple'][
'border_details'][
'R'][
'w'] / 2 - $cell[
'padding'][
'L'] - $cell[
'padding'][
'R'];
16186 if ($cell[
'a'] ==
'C' || $this->table[($level + 1)][$objattr[
'nestedcontent']][
'a'] ==
'C') {
16187 $ncx += ($innerw - $ntw) / 2;
16188 } elseif ($cell[
'a'] ==
'R' || $this->table[($level + 1)][$objattr[
'nestedcontent']][
'a'] ==
'R') {
16189 $ncx += $innerw - $ntw;
16193 $this->_tableWrite($this->table[($level + 1)][$objattr[
'nestedcontent']]);
16194 $this->cellBorderBuffer = $save_buffer;
16196 $this->divwidth = $save_dw;
16199 $this->newFlowingBlock($this->divwidth, $this->divheight, $align, $is_table, $blockstate,
false, $blockdir, $table_draft);
16204 $maxWidth = $this->divwidth;
16207 $maxWidth = $this->divwidth - ($this->blk[$this->blklvl][
'padding_left'] + $this->blk[$this->blklvl][
'border_left'][
'w'] + $this->blk[$this->blklvl][
'padding_right'] + $this->blk[$this->blklvl][
'border_right'][
'w']);
16212 if (isset($this->floatmargins[
'R']) && $this->y <= $this->floatmargins[
'R'][
'y1'] && $this->y >= $this->floatmargins[
'R'][
'y0']) {
16213 $maxWidth -= $this->floatmargins[
'R'][
'w'];
16215 if (isset($this->floatmargins[
'L']) && $this->y <= $this->floatmargins[
'L'][
'y1'] && $this->y >= $this->floatmargins[
'L'][
'y0']) {
16216 $maxWidth -= $this->floatmargins[
'L'][
'w'];
16220 list($skipln) = $this->inlineObject($objattr[
'type'],
'', $this->y, $objattr, $this->lMargin, ($this->flowingBlockAttr[
'contentWidth'] / Mpdf::SCALE), $maxWidth, $this->flowingBlockAttr[
'height'],
false, $is_table);
16225 $oldpage = $this->page;
16226 $oldcol = $this->CurrCol;
16227 if (($skipln == 1 || $skipln == -2) && !isset($objattr[
'float'])) {
16228 $this->finishFlowingBlock(
false, $objattr[
'type']);
16229 $this->newFlowingBlock($this->divwidth, $this->divheight, $align, $is_table, $blockstate,
false, $blockdir, $table_draft);
16232 if (!$table_draft) {
16233 $thispage = $this->page;
16234 if ($this->CurrCol != $oldcol) {
16235 $changedcol =
true;
16237 $changedcol =
false;
16241 if (!$changedcol && $skipln < 0 && $this->AcceptPageBreak() && $thispage == $oldpage) {
16242 $this->
AddPage($this->CurOrientation);
16246 if (count($this->objectbuffer)) {
16247 $yadj = $iby - $this->y;
16248 foreach ($this->objectbuffer as $ib => $val) {
16249 if ($this->objectbuffer[$ib][
'OUTER-Y']) {
16250 $this->objectbuffer[$ib][
'OUTER-Y'] -= $yadj;
16252 if ($this->objectbuffer[$ib][
'BORDER-Y']) {
16253 $this->objectbuffer[$ib][
'BORDER-Y'] -= $yadj;
16255 if ($this->objectbuffer[$ib][
'INNER-Y']) {
16256 $this->objectbuffer[$ib][
'INNER-Y'] -= $yadj;
16263 if ($this->page != $oldpage) {
16264 if (($this->page - $oldpage) % 2 == 1) {
16265 $bak_x += $this->MarginCorrection;
16267 $oldpage = $this->page;
16268 $y = $this->tMargin - $paint_ht_corr;
16269 $this->oldy = $this->tMargin - $paint_ht_corr;
16276 if ($this->CurrCol != $oldcolumn) {
16277 if ($this->directionality ==
'rtl') {
16278 $bak_x -= ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16281 $bak_x += ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16284 $oldcolumn = $this->CurrCol;
16285 $y = $this->y0 - $paint_ht_corr;
16286 $this->oldy = $this->y0 - $paint_ht_corr;
16293 if ($objattr[
'type'] ==
'image' && isset($objattr[
'float'])) {
16297 if ($this->flowingBlockAttr[
'newblock'] && ($this->flowingBlockAttr[
'blockstate'] == 1 || $this->flowingBlockAttr[
'blockstate'] == 3) && $this->flowingBlockAttr[
'lineCount'] == 0) {
16298 $fy += $this->blk[$this->blklvl][
'margin_top'] + $this->blk[$this->blklvl][
'padding_top'] + $this->blk[$this->blklvl][
'border_top'][
'w'];
16301 if ($objattr[
'float'] ==
'R') {
16302 $fx = $this->w - $this->rMargin - $objattr[
'width'] - ($this->blk[$this->blklvl][
'outer_right_margin'] + $this->blk[$this->blklvl][
'border_right'][
'w'] + $this->blk[$this->blklvl][
'padding_right']);
16303 } elseif ($objattr[
'float'] ==
'L') {
16304 $fx = $this->lMargin + ($this->blk[$this->blklvl][
'outer_left_margin'] + $this->blk[$this->blklvl][
'border_left'][
'w'] + $this->blk[$this->blklvl][
'padding_left']);
16306 $w = $objattr[
'width'];
16307 $h = abs($objattr[
'height']);
16309 $widthLeft = $maxWidth - ($this->flowingBlockAttr[
'contentWidth'] / Mpdf::SCALE);
16310 $maxHeight = $this->h - ($this->tMargin + $this->margin_header + $this->bMargin + 10);
16312 $extraWidth = ($objattr[
'border_left'][
'w'] + $objattr[
'border_right'][
'w'] + $objattr[
'margin_left'] + $objattr[
'margin_right']);
16313 $extraHeight = ($objattr[
'border_top'][
'w'] + $objattr[
'border_bottom'][
'w'] + $objattr[
'margin_top'] + $objattr[
'margin_bottom']);
16315 if ($objattr[
'itype'] ==
'wmf' || $objattr[
'itype'] ==
'svg') {
16316 $file = $objattr[
'file'];
16317 $info = $this->formobjects[$file];
16319 $file = $objattr[
'file'];
16320 $info = $this->images[$file];
16322 $img_w = $w - $extraWidth;
16323 $img_h = $h - $extraHeight;
16324 if ($objattr[
'border_left'][
'w']) {
16325 $objattr[
'BORDER-WIDTH'] = $img_w + (($objattr[
'border_left'][
'w'] + $objattr[
'border_right'][
'w']) / 2);
16326 $objattr[
'BORDER-HEIGHT'] = $img_h + (($objattr[
'border_top'][
'w'] + $objattr[
'border_bottom'][
'w']) / 2);
16327 $objattr[
'BORDER-X'] = $fx + $objattr[
'margin_left'] + (($objattr[
'border_left'][
'w']) / 2);
16328 $objattr[
'BORDER-Y'] = $fy + $objattr[
'margin_top'] + (($objattr[
'border_top'][
'w']) / 2);
16330 $objattr[
'INNER-WIDTH'] = $img_w;
16331 $objattr[
'INNER-HEIGHT'] = $img_h;
16332 $objattr[
'INNER-X'] = $fx + $objattr[
'margin_left'] + ($objattr[
'border_left'][
'w']);
16333 $objattr[
'INNER-Y'] = $fy + $objattr[
'margin_top'] + ($objattr[
'border_top'][
'w']);
16334 $objattr[
'ID'] = $info[
'i'];
16335 $objattr[
'OUTER-WIDTH'] = $w;
16336 $objattr[
'OUTER-HEIGHT'] = $h;
16337 $objattr[
'OUTER-X'] = $fx;
16338 $objattr[
'OUTER-Y'] = $fy;
16339 if ($objattr[
'float'] ==
'R') {
16341 $this->floatmargins[
'R'][
'skipline'] =
false;
16342 if (isset($this->floatmargins[
'R'][
'y1']) && $this->floatmargins[
'R'][
'y1'] > 0 && $fy < $this->floatmargins[
'R'][
'y1']) {
16343 $this->WriteFlowingBlock($vetor[0], $vetor[18]);
16345 elseif (isset($this->floatmargins[
'L'][
'y1']) && $this->floatmargins[
'L'][
'y1'] > 0 && $fy < $this->floatmargins[
'L'][
'y1']) {
16347 $mw = 2 * $this->GetCharWidth(
'W',
false);
16348 if (($this->blk[$this->blklvl][
'inner_width'] - $w - $this->floatmargins[
'L'][
'w']) < $mw) {
16349 $this->WriteFlowingBlock($vetor[0], $vetor[18]);
16351 $this->floatmargins[
'R'][
'x'] = $fx;
16352 $this->floatmargins[
'R'][
'w'] = $w;
16353 $this->floatmargins[
'R'][
'y0'] = $fy;
16354 $this->floatmargins[
'R'][
'y1'] = $fy + $h;
16355 if ($skipln == 1) {
16356 $this->floatmargins[
'R'][
'skipline'] =
true;
16357 $this->floatmargins[
'R'][
'id'] = count($this->floatbuffer) + 0;
16358 $objattr[
'skipline'] =
true;
16360 $this->floatbuffer[] = $objattr;
16363 $this->floatmargins[
'R'][
'x'] = $fx;
16364 $this->floatmargins[
'R'][
'w'] = $w;
16365 $this->floatmargins[
'R'][
'y0'] = $fy;
16366 $this->floatmargins[
'R'][
'y1'] = $fy + $h;
16367 if ($skipln == 1) {
16368 $this->floatmargins[
'R'][
'skipline'] =
true;
16369 $this->floatmargins[
'R'][
'id'] = count($this->floatbuffer) + 0;
16370 $objattr[
'skipline'] =
true;
16372 $this->floatbuffer[] = $objattr;
16374 } elseif ($objattr[
'float'] ==
'L') {
16376 $this->floatmargins[
'L'][
'skipline'] =
false;
16377 if (isset($this->floatmargins[
'L'][
'y1']) && $this->floatmargins[
'L'][
'y1'] > 0 && $fy < $this->floatmargins[
'L'][
'y1']) {
16378 $this->floatmargins[
'L'][
'skipline'] =
false;
16379 $this->WriteFlowingBlock($vetor[0], $vetor[18]);
16381 elseif (isset($this->floatmargins[
'R'][
'y1']) && $this->floatmargins[
'R'][
'y1'] > 0 && $fy < $this->floatmargins[
'R'][
'y1']) {
16383 $mw = 2 * $this->GetCharWidth(
'W',
false);
16384 if (($this->blk[$this->blklvl][
'inner_width'] - $w - $this->floatmargins[
'R'][
'w']) < $mw) {
16385 $this->WriteFlowingBlock($vetor[0], $vetor[18]);
16387 $this->floatmargins[
'L'][
'x'] = $fx + $w;
16388 $this->floatmargins[
'L'][
'w'] = $w;
16389 $this->floatmargins[
'L'][
'y0'] = $fy;
16390 $this->floatmargins[
'L'][
'y1'] = $fy + $h;
16391 if ($skipln == 1) {
16392 $this->floatmargins[
'L'][
'skipline'] =
true;
16393 $this->floatmargins[
'L'][
'id'] = count($this->floatbuffer) + 0;
16394 $objattr[
'skipline'] =
true;
16396 $this->floatbuffer[] = $objattr;
16399 $this->floatmargins[
'L'][
'x'] = $fx + $w;
16400 $this->floatmargins[
'L'][
'w'] = $w;
16401 $this->floatmargins[
'L'][
'y0'] = $fy;
16402 $this->floatmargins[
'L'][
'y1'] = $fy + $h;
16403 if ($skipln == 1) {
16404 $this->floatmargins[
'L'][
'skipline'] =
true;
16405 $this->floatmargins[
'L'][
'id'] = count($this->floatbuffer) + 0;
16406 $objattr[
'skipline'] =
true;
16408 $this->floatbuffer[] = $objattr;
16413 $this->WriteFlowingBlock($vetor[0], (isset($vetor[18]) ? $vetor[18] :
null));
16420 if ($this->tableLevel) {
16421 $paint_ht_corr = 0;
16424 $paint_ht_corr = $this->blk[$this->blklvl][
'border_top'][
'w'];
16427 if ($vetor[0] ==
"\n") {
16428 if ($this->flowingBlockAttr[
'content']) {
16429 $this->finishFlowingBlock(
false,
'br');
16430 } elseif ($is_table) {
16431 $this->y+= $this->_computeLineheight($this->cellLineHeight);
16432 } elseif (!$is_table) {
16433 $this->DivLn($this->lineheight);
16434 if ($this->ColActive) {
16435 $this->breakpoints[$this->CurrCol][] = $this->y;
16439 if ($this->page != $oldpage) {
16440 if (($this->page - $oldpage) % 2 == 1) {
16441 $bak_x += $this->MarginCorrection;
16443 $oldpage = $this->page;
16444 $y = $this->tMargin - $paint_ht_corr;
16445 $this->oldy = $this->tMargin - $paint_ht_corr;
16452 if ($this->CurrCol != $oldcolumn) {
16453 if ($this->directionality ==
'rtl') {
16454 $bak_x -= ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16457 $bak_x += ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16460 $oldcolumn = $this->CurrCol;
16461 $y = $this->y0 - $paint_ht_corr;
16462 $this->oldy = $this->y0 - $paint_ht_corr;
16466 $this->newFlowingBlock($this->divwidth, $this->divheight, $align, $is_table, $blockstate,
false, $blockdir, $table_draft);
16468 $this->WriteFlowingBlock($vetor[0], $vetor[18]);
16470 if ($this->page != $oldpage) {
16471 if (($this->page - $oldpage) % 2 == 1) {
16472 $bak_x += $this->MarginCorrection;
16475 $oldpage = $this->page;
16476 $y = $this->tMargin - $paint_ht_corr;
16477 $this->oldy = $this->tMargin - $paint_ht_corr;
16483 if ($this->CurrCol != $oldcolumn) {
16484 if ($this->directionality ==
'rtl') {
16485 $bak_x -= ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16488 $bak_x += ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16491 $oldcolumn = $this->CurrCol;
16492 $y = $this->y0 - $paint_ht_corr;
16493 $this->oldy = $this->y0 - $paint_ht_corr;
16501 if ($i == ($array_size - 1)) {
16502 $this->finishFlowingBlock(
true);
16504 if ($this->page != $oldpage) {
16505 if (($this->page - $oldpage) % 2 == 1) {
16506 $bak_x += $this->MarginCorrection;
16509 $oldpage = $this->page;
16510 $y = $this->tMargin - $paint_ht_corr;
16511 $this->oldy = $this->tMargin - $paint_ht_corr;
16518 if ($this->CurrCol != $oldcolumn) {
16519 if ($this->directionality ==
'rtl') {
16520 $bak_x -= ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16523 $bak_x += ($this->CurrCol - $oldcolumn) * ($this->ColWidth + $this->ColGap);
16526 $oldcolumn = $this->CurrCol;
16527 $y = $this->y0 - $paint_ht_corr;
16528 $this->oldy = $this->y0 - $paint_ht_corr;
16535 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
16536 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
16537 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
16538 $this->colorarray =
'';
16539 $this->spanbgcolorarray =
'';
16540 $this->spanbgcolor =
false;
16541 $this->spanborder =
false;
16542 $this->spanborddet = [];
16544 $this->textparam = [];
16545 $this->SetTextOutline();
16547 $this->textvar = 0x00;
16548 $this->OTLtags = [];
16549 $this->textshadow =
'';
16551 $this->currentfontfamily =
'';
16552 $this->currentfontsize =
'';
16553 $this->currentfontstyle =
'';
16554 $this->currentLang = $this->default_lang;
16555 $this->RestrictUnicodeFonts($this->default_available_fonts);
16557 if ($this->tableLevel) {
16558 $this->SetLineHeight(
'', $this->table[1][1][
'cellLineHeight']);
16560 if (isset($this->blk[$this->blklvl][
'line_height']) && $this->blk[$this->blklvl][
'line_height']) {
16561 $this->SetLineHeight(
'', $this->blk[$this->blklvl][
'line_height']);
16564 $this->ResetStyles();
16565 $this->lSpacingCSS =
'';
16566 $this->wSpacingCSS =
'';
16567 $this->fixedlSpacing =
false;
16568 $this->minwSpacing = 0;
16570 $this->dash_on =
false;
16571 $this->dotted_on =
false;
16576 if ((isset($this->blk[$this->blklvl][
'border']) || isset($this->blk[$this->blklvl][
'bgcolor']) || isset($this->blk[$this->blklvl][
'box_shadow'])) && $blockstate && ($this->y != $this->oldy)) {
16577 $bottom_y = $this->y;
16578 if (isset($this->blk[$this->blklvl][
'startpage']) && $this->blk[$this->blklvl][
'startpage'] != $this->page && $blockstate != 1) {
16579 $this->PaintDivBB(
'pagetop', $blockstate);
16580 } elseif ($blockstate != 1) {
16581 $this->PaintDivBB(
'', $blockstate);
16583 $this->y = $bottom_y;
16588 $this->
SetFontSize($this->default_font_size,
false);
16589 if ($table_draft) {
16590 $ch = $this->y - $bak_y;
16599 if ($style ==
'dashed' && (($side ==
'L' || $side ==
'R') || ($side ==
'T' && $div !=
'pagetop' && !$cp) || ($side ==
'B' && $div !=
'pagebottom') )) {
16602 $this->SetDash($dashsize, ($dashsize / $dashsizek) + ($this->LineWidth * 2));
16603 } elseif ($style ==
'dotted' || ($side ==
'T' && ($div ==
'pagetop' || $cp)) || ($side ==
'B' && $div ==
'pagebottom')) {
16605 $this->SetLineJoin(1);
16606 $this->SetLineCap(1);
16607 $this->SetDash(0.001, ($this->LineWidth * 3));
16614 $this->SetDColor($b[
'c']);
16615 if ($b[
'c'][0] == 5) {
16616 $this->SetAlpha(ord($b[
'c'][4]) / 100,
'Normal',
false,
'S');
16617 } elseif ($b[
'c'][0] == 6) {
16618 $this->SetAlpha(ord($b[
'c'][5]) / 100,
'Normal',
false,
'S');
16625 if ($this->ColActive) {
16628 if ($this->keep_block_together) {
16631 $save_y = $this->y;
16633 $blvl = $this->blklvl;
16635 $x0 = $x1 = $y0 = $y1 = 0;
16638 if (isset($this->blk[$blvl][
'bb_painted'][$this->page]) && $this->blk[$blvl][
'bb_painted'][$this->page]) {
16642 if (isset($this->blk[$blvl][
'x0'])) {
16643 $x0 = $this->blk[$blvl][
'x0'];
16645 if (isset($this->blk[$blvl][
'y1'])) {
16646 $y1 = $this->blk[$blvl][
'y1'];
16650 if ($divider ==
'pagebottom') {
16651 $y1 = $this->h - $this->bMargin;
16657 $continuingpage = (isset($this->blk[$blvl][
'startpage']) && $this->blk[$blvl][
'startpage'] != $this->page);
16659 if (isset($this->blk[$blvl][
'y0'])) {
16660 $y0 = $this->blk[$blvl][
'y0'];
16663 $w = $this->blk[$blvl][
'width'];
16667 $border_top = $this->blk[$blvl][
'border_top'][
'w'];
16668 $border_bottom = $this->blk[$blvl][
'border_bottom'][
'w'];
16669 $border_left = $this->blk[$blvl][
'border_left'][
'w'];
16670 $border_right = $this->blk[$blvl][
'border_right'][
'w'];
16671 if (!$this->blk[$blvl][
'border_top'] || $divider ==
'pagetop' || $continuingpage) {
16674 if (!$this->blk[$blvl][
'border_bottom'] || $blockstate == 1 || $divider ==
'pagebottom') {
16675 $border_bottom = 0;
16689 if (isset($this->blk[$blvl][
'border_radius_TL_H'])) {
16690 $brTL_H = $this->blk[$blvl][
'border_radius_TL_H'];
16693 if (isset($this->blk[$blvl][
'border_radius_TL_V'])) {
16694 $brTL_V = $this->blk[$blvl][
'border_radius_TL_V'];
16697 if (isset($this->blk[$blvl][
'border_radius_TR_H'])) {
16698 $brTR_H = $this->blk[$blvl][
'border_radius_TR_H'];
16701 if (isset($this->blk[$blvl][
'border_radius_TR_V'])) {
16702 $brTR_V = $this->blk[$blvl][
'border_radius_TR_V'];
16705 if (isset($this->blk[$blvl][
'border_radius_BR_H'])) {
16706 $brBR_H = $this->blk[$blvl][
'border_radius_BR_H'];
16709 if (isset($this->blk[$blvl][
'border_radius_BR_V'])) {
16710 $brBR_V = $this->blk[$blvl][
'border_radius_BR_V'];
16713 if (isset($this->blk[$blvl][
'border_radius_BL_H'])) {
16714 $brBL_H = $this->blk[$blvl][
'border_radius_BL_H'];
16717 if (isset($this->blk[$blvl][
'border_radius_BL_V'])) {
16718 $brBL_V = $this->blk[$blvl][
'border_radius_BL_V'];
16722 if (!$this->blk[$blvl][
'border_top'] || $divider ==
'pagetop' || $continuingpage) {
16728 if (!$this->blk[$blvl][
'border_bottom'] || $blockstate == 1 || $divider ==
'pagebottom') {
16736 if ($brTL_H < min($border_left, $border_top)) {
16737 $brTL_H = $brTL_V = 0;
16739 if ($brTL_V < min($border_left, $border_top)) {
16740 $brTL_V = $brTL_H = 0;
16742 if ($brTR_H < min($border_right, $border_top)) {
16743 $brTR_H = $brTR_V = 0;
16745 if ($brTR_V < min($border_right, $border_top)) {
16746 $brTR_V = $brTR_H = 0;
16748 if ($brBL_H < min($border_left, $border_bottom)) {
16749 $brBL_H = $brBL_V = 0;
16751 if ($brBL_V < min($border_left, $border_bottom)) {
16752 $brBL_V = $brBL_H = 0;
16754 if ($brBR_H < min($border_right, $border_bottom)) {
16755 $brBR_H = $brBR_V = 0;
16757 if ($brBR_V < min($border_right, $border_bottom)) {
16758 $brBR_V = $brBR_H = 0;
16762 $f = min($h / ($brTL_V + $brBL_V + 0.001), $h / ($brTR_V + $brBR_V + 0.001), $w / ($brTL_H + $brTR_H + 0.001), $w / ($brBL_H + $brBR_H + 0.001));
16775 $tbcol = $this->colorConverter->convert(255, $this->PDFAXwarnings);
16776 for ($l = 0; $l <= $blvl; $l++) {
16777 if ($this->blk[$l][
'bgcolor']) {
16778 $tbcol = $this->blk[$l][
'bgcolorarray'];
16783 if (isset($this->blk[$blvl][
'y0']) && $this->blk[$blvl][
'y0']) {
16784 $y0 = $this->blk[$blvl][
'y0'];
16787 $w = $this->blk[$blvl][
'width'];
16789 if ($this->blk[$blvl][
'border_top'] && $divider !=
'pagetop' && !$continuingpage) {
16790 $tbd = $this->blk[$blvl][
'border_top'];
16796 if (isset($this->blk[$blvl][
'border_legend']) && $this->blk[$blvl][
'border_legend']) {
16797 $legend = $this->blk[$blvl][
'border_legend'];
16798 $txt = $legend[0] = ltrim($legend[0]);
16799 if (!empty($legend[18])) {
16800 $this->otl->trimOTLdata($legend[18],
true,
false);
16803 $this->
SetFont($legend[4], $legend[2], $legend[11]);
16804 if (isset($legend[3]) && $legend[3]) {
16806 $this->SetTColor($cor);
16808 $stringWidth = $this->GetStringWidth($txt,
true, $legend[18], $legend[8]);
16809 $save_x = $this->x;
16810 $save_y = $this->y;
16811 $save_currentfontfamily = $this->FontFamily;
16812 $save_currentfontsize = $this->FontSizePt;
16813 $save_currentfontstyle = $this->FontStyle;
16814 $this->y = $y0 - $this->FontSize / 2 + $this->blk[$blvl][
'border_top'][
'w'] / 2;
16815 $this->x = $x0 + $this->blk[$blvl][
'padding_left'] + $this->blk[$blvl][
'border_left'][
'w'];
16818 $gap = 0.2 * $this->FontSize;
16819 $legbreakL = $this->x - $gap;
16820 $legbreakR = $this->x + $stringWidth + $gap;
16821 $this->magic_reverse_dir($txt, $this->blk[$blvl][
'direction'], $legend[18]);
16823 $this->Cell($stringWidth, $this->FontSize, $txt,
'', 0,
'C', $fill,
'', 0, 0, 0,
'M', $fill,
false, $legend[18], $legend[8]);
16825 $this->x = $save_x;
16826 $this->y = $save_y;
16827 $this->
SetFont($save_currentfontfamily, $save_currentfontstyle, $save_currentfontsize);
16828 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
16831 if (isset($tbd[
's']) && $tbd[
's']) {
16832 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
16833 $this->writer->write(
'q');
16835 $this->writer->write(sprintf(
'%.3F %.3F m ', ($x0) * Mpdf::SCALE, ($this->h - ($y0)) * Mpdf::SCALE));
16836 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $border_left) * Mpdf::SCALE, ($this->h - ($y0 + $border_top)) * Mpdf::SCALE));
16837 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w - $border_right) * Mpdf::SCALE, ($this->h - ($y0 + $border_top)) * Mpdf::SCALE));
16838 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w) * Mpdf::SCALE, ($this->h - ($y0)) * Mpdf::SCALE));
16839 $this->writer->write(
' h W n ');
16842 $this->_setBorderLine($tbd);
16843 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
16844 $legbreakL -= $border_top / 2;
16845 $legbreakR += $border_top / 2;
16846 $this->_setDashBorder($tbd[
'style'], $divider, $continuingpage,
'T');
16847 } elseif (($brTL_V && $brTL_H) || ($brTR_V && $brTR_H) || $tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16848 $this->SetLineJoin(0);
16849 $this->SetLineCap(0);
16852 if ($brTR_H && $brTR_V) {
16853 $s .= ($this->_EllipseArc($x0 + $w - $brTR_H, $y0 + $brTR_V, $brTR_H - $border_top / 2, $brTR_V - $border_top / 2, 1, 2,
true)) .
"\n";
16855 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16856 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + $w) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16858 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + $w - ($border_top / 2)) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16862 if ($brTL_H && $brTL_V) {
16864 if ($legbreakR < ($x0 + $w - $brTR_H)) {
16865 $s .= (sprintf(
'%.3F %.3F l ', $legbreakR * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16867 if ($legbreakL > ($x0 + $brTL_H )) {
16868 $s .= (sprintf(
'%.3F %.3F m ', $legbreakL * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16869 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $brTL_H ) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE) .
"\n");
16871 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + $brTL_H ) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16874 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $brTL_H ) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16876 $s .= ($this->_EllipseArc($x0 + $brTL_H, $y0 + $brTL_V, $brTL_H - $border_top / 2, $brTL_V - $border_top / 2, 2, 1)) .
"\n";
16880 if ($legbreakR < ($x0 + $w)) {
16881 $s .= (sprintf(
'%.3F %.3F l ', $legbreakR * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16883 if ($legbreakL > ($x0)) {
16884 $s .= (sprintf(
'%.3F %.3F m ', $legbreakL * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16885 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16886 $s .= (sprintf(
'%.3F %.3F l ', ($x0) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16888 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + ($border_top / 2)) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16890 } elseif ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16891 $s .= (sprintf(
'%.3F %.3F m ', ($x0) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16893 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + $border_top / 2) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16895 } elseif ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16896 $s .= (sprintf(
'%.3F %.3F l ', ($x0) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16898 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + ($border_top / 2)) * Mpdf::SCALE, ($this->h - ($y0 + ($border_top / 2))) * Mpdf::SCALE)) .
"\n";
16904 $this->writer->write($s);
16906 if ($tbd[
'style'] ==
'double') {
16908 $this->SetDColor($tbcol);
16909 $this->writer->write($s);
16911 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
16912 $this->writer->write(
'Q');
16917 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
16918 $this->SetLineJoin(2);
16919 $this->SetLineCap(2);
16926 if ($this->blk[$blvl][
'border_bottom'] && $blockstate != 1 && $divider !=
'pagebottom') {
16927 $tbd = $this->blk[$blvl][
'border_bottom'];
16928 if (isset($tbd[
's']) && $tbd[
's']) {
16929 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
16930 $this->writer->write(
'q');
16932 $this->writer->write(sprintf(
'%.3F %.3F m ', ($x0) * Mpdf::SCALE, ($this->h - ($y0 + $h)) * Mpdf::SCALE));
16933 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $border_left) * Mpdf::SCALE, ($this->h - ($y0 + $h - $border_bottom)) * Mpdf::SCALE));
16934 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w - $border_right) * Mpdf::SCALE, ($this->h - ($y0 + $h - $border_bottom)) * Mpdf::SCALE));
16935 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w) * Mpdf::SCALE, ($this->h - ($y0 + $h)) * Mpdf::SCALE));
16936 $this->writer->write(
' h W n ');
16939 $this->_setBorderLine($tbd);
16940 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
16941 $this->_setDashBorder($tbd[
'style'], $divider, $continuingpage,
'B');
16942 } elseif (($brBL_V && $brBL_H) || ($brBR_V && $brBR_H) || $tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16943 $this->SetLineJoin(0);
16944 $this->SetLineCap(0);
16947 if ($brBL_H && $brBL_V) {
16948 $s .= ($this->_EllipseArc($x0 + $brBL_H, $y0 + $h - $brBL_V, $brBL_H - $border_bottom / 2, $brBL_V - $border_bottom / 2, 3, 2,
true)) .
"\n";
16950 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16951 $s .= (sprintf(
'%.3F %.3F m ', ($x0) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_bottom / 2))) * Mpdf::SCALE)) .
"\n";
16953 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + ($border_bottom / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_bottom / 2))) * Mpdf::SCALE)) .
"\n";
16957 if ($brBR_H && $brBR_V) {
16958 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $w - ($border_bottom / 2) - $brBR_H ) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_bottom / 2))) * Mpdf::SCALE)) .
"\n";
16959 $s .= ($this->_EllipseArc($x0 + $w - $brBR_H, $y0 + $h - $brBR_V, $brBR_H - $border_bottom / 2, $brBR_V - $border_bottom / 2, 4, 1)) .
"\n";
16961 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
16962 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $w) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_bottom / 2))) * Mpdf::SCALE)) .
"\n";
16964 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $w - ($border_bottom / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_bottom / 2))) * Mpdf::SCALE)) .
"\n";
16968 $this->writer->write($s);
16970 if ($tbd[
'style'] ==
'double') {
16972 $this->SetDColor($tbcol);
16973 $this->writer->write($s);
16975 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
16976 $this->writer->write(
'Q');
16981 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
16982 $this->SetLineJoin(2);
16983 $this->SetLineCap(2);
16990 if ($this->blk[$blvl][
'border_left']) {
16991 $tbd = $this->blk[$blvl][
'border_left'];
16992 if (isset($tbd[
's']) && $tbd[
's']) {
16993 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
16994 $this->writer->write(
'q');
16996 $this->writer->write(sprintf(
'%.3F %.3F m ', ($x0) * Mpdf::SCALE, ($this->h - ($y0)) * Mpdf::SCALE));
16997 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $border_left) * Mpdf::SCALE, ($this->h - ($y0 + $border_top)) * Mpdf::SCALE));
16998 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $border_left) * Mpdf::SCALE, ($this->h - ($y0 + $h - $border_bottom)) * Mpdf::SCALE));
16999 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0) * Mpdf::SCALE, ($this->h - ($y0 + $h)) * Mpdf::SCALE));
17000 $this->writer->write(
' h W n ');
17003 $this->_setBorderLine($tbd);
17004 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17005 $this->_setDashBorder($tbd[
'style'], $divider, $continuingpage,
'L');
17006 } elseif (($brTL_V && $brTL_H) || ($brBL_V && $brBL_H) || $tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
17007 $this->SetLineJoin(0);
17008 $this->SetLineCap(0);
17011 if ($brTL_V && $brTL_H) {
17012 $s .= ($this->_EllipseArc($x0 + $brTL_H, $y0 + $brTL_V, $brTL_H - $border_left / 2, $brTL_V - $border_left / 2, 2, 2,
true)) .
"\n";
17014 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
17015 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + ($border_left / 2)) * Mpdf::SCALE, ($this->h - ($y0)) * Mpdf::SCALE)) .
"\n";
17017 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + ($border_left / 2)) * Mpdf::SCALE, ($this->h - ($y0 + ($border_left / 2))) * Mpdf::SCALE)) .
"\n";
17021 if ($brBL_V && $brBL_H) {
17022 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + ($border_left / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_left / 2) - $brBL_V) ) * Mpdf::SCALE)) .
"\n";
17023 $s .= ($this->_EllipseArc($x0 + $brBL_H, $y0 + $h - $brBL_V, $brBL_H - $border_left / 2, $brBL_V - $border_left / 2, 3, 1)) .
"\n";
17025 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
17026 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + ($border_left / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h) ) * Mpdf::SCALE)) .
"\n";
17028 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + ($border_left / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_left / 2)) ) * Mpdf::SCALE)) .
"\n";
17032 $this->writer->write($s);
17034 if ($tbd[
'style'] ==
'double') {
17036 $this->SetDColor($tbcol);
17037 $this->writer->write($s);
17039 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
17040 $this->writer->write(
'Q');
17045 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
17046 $this->SetLineJoin(2);
17047 $this->SetLineCap(2);
17051 if ($this->blk[$blvl][
'border_right']) {
17052 $tbd = $this->blk[$blvl][
'border_right'];
17053 if (isset($tbd[
's']) && $tbd[
's']) {
17054 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
17055 $this->writer->write(
'q');
17057 $this->writer->write(sprintf(
'%.3F %.3F m ', ($x0 + $w) * Mpdf::SCALE, ($this->h - ($y0)) * Mpdf::SCALE));
17058 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w - $border_right) * Mpdf::SCALE, ($this->h - ($y0 + $border_top)) * Mpdf::SCALE));
17059 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w - $border_right) * Mpdf::SCALE, ($this->h - ($y0 + $h - $border_bottom)) * Mpdf::SCALE));
17060 $this->writer->write(sprintf(
'%.3F %.3F l ', ($x0 + $w) * Mpdf::SCALE, ($this->h - ($y0 + $h)) * Mpdf::SCALE));
17061 $this->writer->write(
' h W n ');
17064 $this->_setBorderLine($tbd);
17065 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17066 $this->_setDashBorder($tbd[
'style'], $divider, $continuingpage,
'R');
17067 } elseif (($brTR_V && $brTR_H) || ($brBR_V && $brBR_H) || $tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
17068 $this->SetLineJoin(0);
17069 $this->SetLineCap(0);
17072 if ($brBR_V && $brBR_H) {
17073 $s .= ($this->_EllipseArc($x0 + $w - $brBR_H, $y0 + $h - $brBR_V, $brBR_H - $border_right / 2, $brBR_V - $border_right / 2, 4, 2,
true)) .
"\n";
17075 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
17076 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + $w - ($border_right / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h)) * Mpdf::SCALE)) .
"\n";
17078 $s .= (sprintf(
'%.3F %.3F m ', ($x0 + $w - ($border_right / 2)) * Mpdf::SCALE, ($this->h - ($y0 + $h - ($border_right / 2))) * Mpdf::SCALE)) .
"\n";
17082 if ($brTR_V && $brTR_H) {
17083 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $w - ($border_right / 2)) * Mpdf::SCALE, ($this->h - ($y0 + ($border_right / 2) + $brTR_V) ) * Mpdf::SCALE)) .
"\n";
17084 $s .= ($this->_EllipseArc($x0 + $w - $brTR_H, $y0 + $brTR_V, $brTR_H - $border_right / 2, $brTR_V - $border_right / 2, 1, 1)) .
"\n";
17086 if ($tbd[
'style'] ==
'solid' || $tbd[
'style'] ==
'double') {
17087 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $w - ($border_right / 2)) * Mpdf::SCALE, ($this->h - ($y0) ) * Mpdf::SCALE)) .
"\n";
17089 $s .= (sprintf(
'%.3F %.3F l ', ($x0 + $w - ($border_right / 2)) * Mpdf::SCALE, ($this->h - ($y0 + ($border_right / 2)) ) * Mpdf::SCALE)) .
"\n";
17093 $this->writer->write($s);
17095 if ($tbd[
'style'] ==
'double') {
17097 $this->SetDColor($tbcol);
17098 $this->writer->write($s);
17100 if (!$brset && $tbd[
'style'] !=
'dotted' && $tbd[
'style'] !=
'dashed') {
17101 $this->writer->write(
'Q');
17106 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
17107 $this->SetLineJoin(2);
17108 $this->SetLineCap(2);
17115 $this->y = $save_y;
17119 if ($this->ColActive || $this->kwt || $this->keep_block_together) {
17130 if (isset($this->blk[$blvl][
'background_clip']) && $this->blk[$blvl][
'background_clip'] ==
'padding-box') {
17131 $brbgTL_H = max(0, $brTL_H - $this->blk[$blvl][
'border_left'][
'w']);
17132 $brbgTL_V = max(0, $brTL_V - $this->blk[$blvl][
'border_top'][
'w']);
17133 $brbgTR_H = max(0, $brTR_H - $this->blk[$blvl][
'border_right'][
'w']);
17134 $brbgTR_V = max(0, $brTR_V - $this->blk[$blvl][
'border_top'][
'w']);
17135 $brbgBL_H = max(0, $brBL_H - $this->blk[$blvl][
'border_left'][
'w']);
17136 $brbgBL_V = max(0, $brBL_V - $this->blk[$blvl][
'border_bottom'][
'w']);
17137 $brbgBR_H = max(0, $brBR_H - $this->blk[$blvl][
'border_right'][
'w']);
17138 $brbgBR_V = max(0, $brBR_V - $this->blk[$blvl][
'border_bottom'][
'w']);
17139 $bgx0 += $this->blk[$blvl][
'border_left'][
'w'];
17140 $bgx1 -= $this->blk[$blvl][
'border_right'][
'w'];
17141 if ($this->blk[$blvl][
'border_top'] && $divider !=
'pagetop' && !$continuingpage) {
17142 $bgy0 += $this->blk[$blvl][
'border_top'][
'w'];
17144 if ($this->blk[$blvl][
'border_bottom'] && $blockstate != 1 && $divider !=
'pagebottom') {
17145 $bgy1 -= $this->blk[$blvl][
'border_bottom'][
'w'];
17147 } elseif (isset($this->blk[$blvl][
'background_clip']) && $this->blk[$blvl][
'background_clip'] ==
'content-box') {
17148 $brbgTL_H = max(0, $brTL_H - $this->blk[$blvl][
'border_left'][
'w'] - $this->blk[$blvl][
'padding_left']);
17149 $brbgTL_V = max(0, $brTL_V - $this->blk[$blvl][
'border_top'][
'w'] - $this->blk[$blvl][
'padding_top']);
17150 $brbgTR_H = max(0, $brTR_H - $this->blk[$blvl][
'border_right'][
'w'] - $this->blk[$blvl][
'padding_right']);
17151 $brbgTR_V = max(0, $brTR_V - $this->blk[$blvl][
'border_top'][
'w'] - $this->blk[$blvl][
'padding_top']);
17152 $brbgBL_H = max(0, $brBL_H - $this->blk[$blvl][
'border_left'][
'w'] - $this->blk[$blvl][
'padding_left']);
17153 $brbgBL_V = max(0, $brBL_V - $this->blk[$blvl][
'border_bottom'][
'w'] - $this->blk[$blvl][
'padding_bottom']);
17154 $brbgBR_H = max(0, $brBR_H - $this->blk[$blvl][
'border_right'][
'w'] - $this->blk[$blvl][
'padding_right']);
17155 $brbgBR_V = max(0, $brBR_V - $this->blk[$blvl][
'border_bottom'][
'w'] - $this->blk[$blvl][
'padding_bottom']);
17156 $bgx0 += $this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'padding_left'];
17157 $bgx1 -= $this->blk[$blvl][
'border_right'][
'w'] + $this->blk[$blvl][
'padding_right'];
17158 if (($this->blk[$blvl][
'border_top'][
'w'] || $this->blk[$blvl][
'padding_top']) && $divider !=
'pagetop' && !$continuingpage) {
17159 $bgy0 += $this->blk[$blvl][
'border_top'][
'w'] + $this->blk[$blvl][
'padding_top'];
17161 if (($this->blk[$blvl][
'border_bottom'][
'w'] || $this->blk[$blvl][
'padding_bottom']) && $blockstate != 1 && $divider !=
'pagebottom') {
17162 $bgy1 -= $this->blk[$blvl][
'border_bottom'][
'w'] + $this->blk[$blvl][
'padding_bottom'];
17165 $brbgTL_H = $brTL_H;
17166 $brbgTL_V = $brTL_V;
17167 $brbgTR_H = $brTR_H;
17168 $brbgTR_V = $brTR_V;
17169 $brbgBL_H = $brBL_H;
17170 $brbgBL_V = $brBL_V;
17171 $brbgBR_H = $brBR_H;
17172 $brbgBR_V = $brBR_V;
17177 $s .= sprintf(
'%.3F %.3F m ', ($bgx0 + $brbgTL_H ) * Mpdf::SCALE, ($this->h - $bgy0) * Mpdf::SCALE);
17179 if ($brbgTL_H || $brbgTL_V) {
17180 $s .= $this->_EllipseArc($bgx0 + $brbgTL_H, $bgy0 + $brbgTL_V, $brbgTL_H, $brbgTL_V, 2);
17183 $s .= sprintf(
'%.3F %.3F l ', ($bgx0) * Mpdf::SCALE, ($this->h - ($bgy1 - $brbgBL_V )) * Mpdf::SCALE);
17185 if ($brbgBL_H || $brbgBL_V) {
17186 $s .= $this->_EllipseArc($bgx0 + $brbgBL_H, $bgy1 - $brbgBL_V, $brbgBL_H, $brbgBL_V, 3);
17189 $s .= sprintf(
'%.3F %.3F l ', ($bgx1 - $brbgBR_H ) * Mpdf::SCALE, ($this->h - ($bgy1)) * Mpdf::SCALE);
17191 if ($brbgBR_H || $brbgBR_V) {
17192 $s .= $this->_EllipseArc($bgx1 - $brbgBR_H, $bgy1 - $brbgBR_V, $brbgBR_H, $brbgBR_V, 4);
17195 $s .= sprintf(
'%.3F %.3F l ', ($bgx1) * Mpdf::SCALE, ($this->h - ($bgy0 + $brbgTR_V)) * Mpdf::SCALE);
17197 if ($brbgTR_H || $brbgTR_V) {
17198 $s .= $this->_EllipseArc($bgx1 - $brbgTR_H, $bgy0 + $brbgTR_V, $brbgTR_H, $brbgTR_V, 1);
17201 $s .= sprintf(
'%.3F %.3F l ', ($bgx0 + $brbgTL_H ) * Mpdf::SCALE, ($this->h - $bgy0) * Mpdf::SCALE);
17204 if (isset($this->blk[$blvl][
'box_shadow']) && $this->blk[$blvl][
'box_shadow'] && $h > 0) {
17205 foreach ($this->blk[$blvl][
'box_shadow'] as $sh) {
17207 if ($sh[
'col'][0] == 1) {
17208 $colspace =
'Gray';
17209 if ($sh[
'col'][2] == 1) {
17210 $col1 =
'1' . $sh[
'col'][1] .
'1' . $sh[
'col'][3];
17212 $col1 =
'1' . $sh[
'col'][1] .
'1' . chr(100);
17214 $col2 =
'1' . $sh[
'col'][1] .
'1' . chr(0);
17215 } elseif ($sh[
'col'][0] == 4) {
17216 $colspace =
'CMYK';
17217 $col1 =
'6' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . $sh[
'col'][4] . chr(100);
17218 $col2 =
'6' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . $sh[
'col'][4] . chr(0);
17219 } elseif ($sh[
'col'][0] == 5) {
17221 $col1 =
'5' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . $sh[
'col'][4];
17222 $col2 =
'5' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . chr(0);
17223 } elseif ($sh[
'col'][0] == 6) {
17224 $colspace =
'CMYK';
17225 $col1 =
'6' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . $sh[
'col'][4] . $sh[
'col'][5];
17226 $col2 =
'6' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . $sh[
'col'][4] . chr(0);
17229 $col1 =
'5' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . chr(100);
17230 $col2 =
'5' . $sh[
'col'][1] . $sh[
'col'][2] . $sh[
'col'][3] . chr(0);
17235 $shadow .= sprintf(
'0 %.3F m %.3F %.3F l ', $this->h * Mpdf::SCALE, $this->w * Mpdf::SCALE, $this->h * Mpdf::SCALE);
17236 $shadow .= sprintf(
'%.3F 0 l 0 0 l 0 %.3F l ', $this->w * Mpdf::SCALE, $this->h * Mpdf::SCALE);
17237 $shadow .=
'W n' .
"\n";
17239 $sh[
'blur'] = abs($sh[
'blur']);
17242 if (-$sh[
'spread'] + $sh[
'blur'] / 2 > min($w / 2, $h / 2)) {
17243 $sh[
'spread'] = $sh[
'blur'] / 2 - min($w / 2, $h / 2) + 0.01;
17246 if ($sh[
'x'] || $sh[
'y']) {
17247 $shadow .= sprintf(
' q 1 0 0 1 %.4F %.4F cm', $sh[
'x'] * Mpdf::SCALE, -$sh[
'y'] * Mpdf::SCALE) .
"\n";
17251 $shadow .=
' q 0 w ';
17252 $shadow .= $this->SetFColor($col1,
true) .
"\n";
17253 if ($col1[0] == 5 && ord($col1[4]) < 100) {
17254 $shadow .= $this->SetAlpha(ord($col1[4]) / 100,
'Normal',
true,
'F') .
"\n";
17255 } elseif ($col1[0] == 6 && ord($col1[5]) < 100) {
17256 $shadow .= $this->SetAlpha(ord($col1[5]) / 100,
'Normal',
true,
'F') .
"\n";
17257 } elseif ($col1[0] == 1 && $col1[2] == 1 && ord($col1[3]) < 100) {
17258 $shadow .= $this->SetAlpha(ord($col1[3]) / 100,
'Normal',
true,
'F') .
"\n";
17264 $d1 = $sh[
'spread'] + $sh[
'blur'] / 2;
17265 $d2 = $sh[
'spread'] - $sh[
'blur'] / 2;
17269 $w00 = $w + $d1 * 2;
17270 $h00 = $h + $d1 * 2;
17274 if (max($brbgTR_H, $brbgTL_H, $brbgBR_H, $brbgBL_H) >= $w + $d2) {
17277 if (max($brbgTR_V, $brbgTL_V, $brbgBR_V, $brbgBL_V) >= $h + $d2) {
17283 $p1x = $x00 + $w00 - $d1 - $brbgTR_H;
17284 $p1c2x = $p1x + ($d2 + $brbgTR_H) * $mag;
17286 $p2x = $x00 + $w00 - $d1 - $brbgTR_H;
17287 $p2c2x = $p2x + ($d1 + $brbgTR_H) * $mag;
17289 $p2c1y = $p2y + $bl / 2;
17290 $p3x = $x00 + $w00;
17291 $p3c2x = $p3x - $bl / 2;
17292 $p3y = $y00 + $d1 + $brbgTR_V;
17293 $p3c1y = $p3y - ($d1 + $brbgTR_V) * $mag;
17294 $p4x = $x00 + $w00 - $bl;
17295 $p4y = $y00 + $d1 + $brbgTR_V;
17296 $p4c2y = $p4y - ($d2 + $brbgTR_V) * $mag;
17297 if (-$d2 > min($brbgTR_H, $brbgTR_V) || $flatten) {
17298 $p1x = $x00 + $w00 - $bl;
17300 $p2x = $x00 + $w00 - $bl;
17301 $p2c2x = $p2x + $bl * $mag2;
17303 $p3c1y = $p3y - $bl * $mag2;
17308 $shadow .= sprintf(
'%.3F %.3F m ', ($p1x ) * Mpdf::SCALE, ($this->h - ($p1y )) * Mpdf::SCALE);
17309 $shadow .= sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c ', ($p1c2x) * Mpdf::SCALE, ($this->h - ($p1y)) * Mpdf::SCALE, ($p4x) * Mpdf::SCALE, ($this->h - ($p4c2y)) * Mpdf::SCALE, ($p4x) * Mpdf::SCALE, ($this->h - ($p4y)) * Mpdf::SCALE);
17310 $patch_array[0][
'f'] = 0;
17311 $patch_array[0][
'points'] = [$p1x, $p1y, $p1x, $p1y,
17312 $p2x, $p2c1y, $p2x, $p2y, $p2c2x, $p2y,
17313 $p3x, $p3c1y, $p3x, $p3y, $p3c2x, $p3y,
17314 $p4x, $p4y, $p4x, $p4y, $p4x, $p4c2y,
17316 $patch_array[0][
'colors'] = [$col1, $col2, $col2, $col1];
17320 $p1x = $x00 + $w00;
17321 $p1y = $y00 + $d1 + $brbgTR_V;
17322 $p2x = $x00 + $w00 - $bl;
17323 $p2y = $y00 + $d1 + $brbgTR_V;
17324 $p3x = $x00 + $w00 - $bl;
17325 $p3y = $y00 + $h00 - $d1 - $brbgBR_V;
17326 $p4x = $x00 + $w00;
17327 $p4c1x = $p4x - $bl / 2;
17328 $p4y = $y00 + $h00 - $d1 - $brbgBR_V;
17329 if (-$d2 > min($brbgTR_H, $brbgTR_V) || $flatten) {
17333 if (-$d2 > min($brbgBR_H, $brbgBR_V) || $flatten) {
17334 $p3y = $y00 + $h00 - $bl;
17335 $p4y = $y00 + $h00 - $bl;
17338 $shadow .= sprintf(
'%.3F %.3F l ', ($p3x ) * Mpdf::SCALE, ($this->h - ($p3y )) * Mpdf::SCALE);
17339 $patch_array[1][
'f'] = 2;
17340 $patch_array[1][
'points'] = [$p2x, $p2y,
17341 $p3x, $p3y, $p3x, $p3y, $p3x, $p3y,
17342 $p4c1x, $p4y, $p4x, $p4y, $p4x, $p4y,
17344 $patch_array[1][
'colors'] = [$col1, $col2];
17348 $p1x = $x00 + $w00 - $bl;
17349 $p1y = $y00 + $h00 - $d1 - $brbgBR_V;
17350 $p1c2y = $p1y + ($d2 + $brbgBR_V) * $mag;
17351 $p2x = $x00 + $w00;
17352 $p2y = $y00 + $h00 - $d1 - $brbgBR_V;
17353 $p2c2y = $p2y + ($d1 + $brbgBR_V) * $mag;
17354 $p3x = $x00 + $w00 - $d1 - $brbgBR_H;
17355 $p3c1x = $p3x + ($d1 + $brbgBR_H) * $mag;
17356 $p3y = $y00 + $h00;
17357 $p3c2y = $p3y - $bl / 2;
17358 $p4x = $x00 + $w00 - $d1 - $brbgBR_H;
17359 $p4c2x = $p4x + ($d2 + $brbgBR_H) * $mag;
17360 $p4y = $y00 + $h00 - $bl;
17362 if (-$d2 > min($brbgBR_H, $brbgBR_V) || $flatten) {
17363 $p1y = $y00 + $h00 - $bl;
17365 $p2y = $y00 + $h00 - $bl;
17366 $p2c2y = $p2y + $bl * $mag2;
17367 $p3x = $x00 + $w00 - $bl;
17368 $p3c1x = $p3x + $bl * $mag2;
17369 $p4x = $x00 + $w00 - $bl;
17373 $shadow .= sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c ', ($p1x) * Mpdf::SCALE, ($this->h - ($p1c2y)) * Mpdf::SCALE, ($p4c2x) * Mpdf::SCALE, ($this->h - ($p4y)) * Mpdf::SCALE, ($p4x) * Mpdf::SCALE, ($this->h - ($p4y)) * Mpdf::SCALE);
17374 $patch_array[2][
'f'] = 2;
17375 $patch_array[2][
'points'] = [$p2x, $p2c2y,
17376 $p3c1x, $p3y, $p3x, $p3y, $p3x, $p3c2y,
17377 $p4x, $p4y, $p4x, $p4y, $p4c2x, $p4y,
17379 $patch_array[2][
'colors'] = [$col2, $col1];
17384 $p1x = $x00 + $w00 - $d1 - $brbgBR_H;
17385 $p1y = $y00 + $h00;
17386 $p2x = $x00 + $w00 - $d1 - $brbgBR_H;
17387 $p2y = $y00 + $h00 - $bl;
17388 $p3x = $x00 + $d1 + $brbgBL_H;
17389 $p3y = $y00 + $h00 - $bl;
17390 $p4x = $x00 + $d1 + $brbgBL_H;
17391 $p4y = $y00 + $h00;
17392 $p4c1y = $p4y - $bl / 2;
17394 if (-$d2 > min($brbgBR_H, $brbgBR_V) || $flatten) {
17395 $p1x = $x00 + $w00 - $bl;
17396 $p2x = $x00 + $w00 - $bl;
17398 if (-$d2 > min($brbgBL_H, $brbgBL_V) || $flatten) {
17403 $shadow .= sprintf(
'%.3F %.3F l ', ($p3x ) * Mpdf::SCALE, ($this->h - ($p3y )) * Mpdf::SCALE);
17404 $patch_array[3][
'f'] = 2;
17405 $patch_array[3][
'points'] = [$p2x, $p2y,
17406 $p3x, $p3y, $p3x, $p3y, $p3x, $p3y,
17407 $p4x, $p4c1y, $p4x, $p4y, $p4x, $p4y,
17409 $patch_array[3][
'colors'] = [$col1, $col2];
17412 $p1x = $x00 + $d1 + $brbgBL_H;
17413 $p1c2x = $p1x - ($d2 + $brbgBL_H) * $mag;
17414 $p1y = $y00 + $h00 - $bl;
17415 $p2x = $x00 + $d1 + $brbgBL_H;
17416 $p2c2x = $p2x - ($d1 + $brbgBL_H) * $mag;
17417 $p2y = $y00 + $h00;
17419 $p3c2x = $p3x + $bl / 2;
17420 $p3y = $y00 + $h00 - $d1 - $brbgBL_V;
17421 $p3c1y = $p3y + ($d1 + $brbgBL_V) * $mag;
17423 $p4y = $y00 + $h00 - $d1 - $brbgBL_V;
17424 $p4c2y = $p4y + ($d2 + $brbgBL_V) * $mag;
17425 if (-$d2 > min($brbgBL_H, $brbgBL_V) || $flatten) {
17429 $p2c2x = $p2x - $bl * $mag2;
17430 $p3y = $y00 + $h00 - $bl;
17431 $p3c1y = $p3y + $bl * $mag2;
17432 $p4y = $y00 + $h00 - $bl;
17436 $shadow .= sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c ', ($p1c2x) * Mpdf::SCALE, ($this->h - ($p1y)) * Mpdf::SCALE, ($p4x) * Mpdf::SCALE, ($this->h - ($p4c2y)) * Mpdf::SCALE, ($p4x) * Mpdf::SCALE, ($this->h - ($p4y)) * Mpdf::SCALE);
17437 $patch_array[4][
'f'] = 2;
17438 $patch_array[4][
'points'] = [$p2c2x, $p2y,
17439 $p3x, $p3c1y, $p3x, $p3y, $p3c2x, $p3y,
17440 $p4x, $p4y, $p4x, $p4y, $p4x, $p4c2y,
17442 $patch_array[4][
'colors'] = [$col2, $col1];
17447 $p1y = $y00 + $h00 - $d1 - $brbgBL_V;
17449 $p2y = $y00 + $h00 - $d1 - $brbgBL_V;
17451 $p3y = $y00 + $d1 + $brbgTL_V;
17453 $p4c1x = $p4x + $bl / 2;
17454 $p4y = $y00 + $d1 + $brbgTL_V;
17455 if (-$d2 > min($brbgBL_H, $brbgBL_V) || $flatten) {
17456 $p1y = $y00 + $h00 - $bl;
17457 $p2y = $y00 + $h00 - $bl;
17459 if (-$d2 > min($brbgTL_H, $brbgTL_V) || $flatten) {
17464 $shadow .= sprintf(
'%.3F %.3F l ', ($p3x ) * Mpdf::SCALE, ($this->h - ($p3y )) * Mpdf::SCALE);
17465 $patch_array[5][
'f'] = 2;
17466 $patch_array[5][
'points'] = [$p2x, $p2y,
17467 $p3x, $p3y, $p3x, $p3y, $p3x, $p3y,
17468 $p4c1x, $p4y, $p4x, $p4y, $p4x, $p4y,
17470 $patch_array[5][
'colors'] = [$col1, $col2];
17474 $p1y = $y00 + $d1 + $brbgTL_V;
17475 $p1c2y = $p1y - ($d2 + $brbgTL_V) * $mag;
17477 $p2y = $y00 + $d1 + $brbgTL_V;
17478 $p2c2y = $p2y - ($d1 + $brbgTL_V) * $mag;
17479 $p3x = $x00 + $d1 + $brbgTL_H;
17480 $p3c1x = $p3x - ($d1 + $brbgTL_H) * $mag;
17482 $p3c2y = $p3y + $bl / 2;
17483 $p4x = $x00 + $d1 + $brbgTL_H;
17484 $p4c2x = $p4x - ($d2 + $brbgTL_H) * $mag;
17487 if (-$d2 > min($brbgTL_H, $brbgTL_V) || $flatten) {
17491 $p2c2y = $p2y - $bl * $mag2;
17493 $p3c1x = $p3x - $bl * $mag2;
17498 $shadow .= sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c ', ($p1x) * Mpdf::SCALE, ($this->h - ($p1c2y)) * Mpdf::SCALE, ($p4c2x) * Mpdf::SCALE, ($this->h - ($p4y)) * Mpdf::SCALE, ($p4x) * Mpdf::SCALE, ($this->h - ($p4y)) * Mpdf::SCALE);
17499 $patch_array[6][
'f'] = 2;
17500 $patch_array[6][
'points'] = [$p2x, $p2c2y,
17501 $p3c1x, $p3y, $p3x, $p3y, $p3x, $p3c2y,
17502 $p4x, $p4y, $p4x, $p4y, $p4c2x, $p4y,
17504 $patch_array[6][
'colors'] = [$col2, $col1];
17508 $p1x = $x00 + $d1 + $brbgTL_H;
17510 $p2x = $x00 + $d1 + $brbgTL_H;
17512 $p3x = $x00 + $w00 - $d1 - $brbgTR_H;
17514 $p4x = $x00 + $w00 - $d1 - $brbgTR_H;
17516 $p4c1y = $p4y + $bl / 2;
17517 if (-$d2 > min($brbgTL_H, $brbgTL_V) || $flatten) {
17521 if (-$d2 > min($brbgTR_H, $brbgTR_V) || $flatten) {
17522 $p3x = $x00 + $w00 - $bl;
17523 $p4x = $x00 + $w00 - $bl;
17526 $shadow .= sprintf(
'%.3F %.3F l ', ($p3x ) * Mpdf::SCALE, ($this->h - ($p3y )) * Mpdf::SCALE);
17527 $patch_array[7][
'f'] = 2;
17528 $patch_array[7][
'points'] = [$p2x, $p2y,
17529 $p3x, $p3y, $p3x, $p3y, $p3x, $p3y,
17530 $p4x, $p4c1y, $p4x, $p4y, $p4x, $p4y,
17532 $patch_array[7][
'colors'] = [$col1, $col2];
17534 $shadow .=
' h f Q ' .
"\n";
17537 $shadow .= $this->gradient->CoonsPatchMesh($x00, $y00, $w00, $h00, $patch_array, $x00, $x00 + $w00, $y00, $y00 + $h00, $colspace,
true);
17540 if ($sh[
'x'] || $sh[
'y']) {
17541 $shadow .=
' Q' .
"\n";
17543 $shadow .=
' Q' .
"\n";
17549 if ($this->blk[$blvl][
'bgcolor']) {
17550 $this->pageBackgrounds[$blvl][] = [
17555 'col' => $this->blk[$blvl][
'bgcolorarray'],
17557 'visibility' => $this->visibility,
17558 'shadow' => $shadow,
17559 'z-index' => $this->current_layer,
17561 } elseif ($shadow) {
17562 $this->pageBackgrounds[$blvl][] = [
17567 'shadowonly' =>
true,
17570 'visibility' => $this->visibility,
17571 'shadow' => $shadow,
17572 'z-index' => $this->current_layer,
17577 if (isset($this->blk[$blvl][
'gradient'])) {
17578 $g = $this->gradient->parseBackgroundGradient($this->blk[$blvl][
'gradient']);
17582 $this->pageBackgrounds[$blvl][] = [
17583 'gradient' =>
true,
17588 'gradtype' => $g[
'type'],
17589 'stops' => $g[
'stops'],
17590 'colorspace' => $g[
'colorspace'],
17591 'coords' => $g[
'coords'],
17592 'extend' => $g[
'extend'],
17594 'visibility' => $this->visibility,
17595 'z-index' => $this->current_layer
17600 if (isset($this->blk[$blvl][
'background-image'])) {
17601 if (isset($this->blk[$blvl][
'background-image'][
'gradient']) && $this->blk[$blvl][
'background-image'][
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $this->blk[$blvl][
'background-image'][
'gradient'])) {
17602 $g = $this->gradient->parseMozGradient($this->blk[$blvl][
'background-image'][
'gradient']);
17607 if ($this->blk[$blvl][
'background-image'][
'origin'] ==
'padding-box') {
17608 $gx += $this->blk[$blvl][
'border_left'][
'w'];
17609 $w -= ($this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'border_right'][
'w']);
17610 if ($this->blk[$blvl][
'border_top'] && $divider !=
'pagetop' && !$continuingpage) {
17611 $gy += $this->blk[$blvl][
'border_top'][
'w'];
17613 if ($this->blk[$blvl][
'border_bottom'] && $blockstate != 1 && $divider !=
'pagebottom') {
17614 $gy1 = $y1 - $this->blk[$blvl][
'border_bottom'][
'w'];
17619 } elseif ($this->blk[$blvl][
'background-image'][
'origin'] ==
'content-box') {
17620 $gx += $this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'padding_left'];
17621 $w -= ($this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'padding_left'] + $this->blk[$blvl][
'border_right'][
'w'] + $this->blk[$blvl][
'padding_right']);
17622 if ($this->blk[$blvl][
'border_top'] && $divider !=
'pagetop' && !$continuingpage) {
17623 $gy += $this->blk[$blvl][
'border_top'][
'w'] + $this->blk[$blvl][
'padding_top'];
17625 if ($this->blk[$blvl][
'border_bottom'] && $blockstate != 1 && $divider !=
'pagebottom') {
17626 $gy1 = $y1 - ($this->blk[$blvl][
'border_bottom'][
'w'] + $this->blk[$blvl][
'padding_bottom']);
17628 $gy1 = $y1 - $this->blk[$blvl][
'padding_bottom'];
17633 if (isset($this->blk[$blvl][
'background-image'][
'size'][
'w']) && $this->blk[$blvl][
'background-image'][
'size'][
'w']) {
17634 $size = $this->blk[$blvl][
'background-image'][
'size'];
17635 if ($size[
'w'] !=
'contain' && $size[
'w'] !=
'cover') {
17636 if (stristr($size[
'w'],
'%')) {
17637 $size[
'w'] = (float) $size[
'w'];
17640 } elseif ($size[
'w'] !=
'auto') {
17643 if (stristr($size[
'h'],
'%')) {
17644 $size[
'h'] = (float) $size[
'h'];
17647 } elseif ($size[
'h'] !=
'auto') {
17652 $this->pageBackgrounds[$blvl][] = [
17653 'gradient' =>
true,
17658 'gradtype' => $g[
'type'],
17659 'stops' => $g[
'stops'],
17660 'colorspace' => $g[
'colorspace'],
17661 'coords' => $g[
'coords'],
17662 'extend' => $g[
'extend'],
17664 'visibility' => $this->visibility,
17665 'z-index' => $this->current_layer
17671 $image_id = $this->blk[$blvl][
'background-image'][
'image_id'];
17672 $orig_w = $this->blk[$blvl][
'background-image'][
'orig_w'];
17673 $orig_h = $this->blk[$blvl][
'background-image'][
'orig_h'];
17674 $x_pos = $this->blk[$blvl][
'background-image'][
'x_pos'];
17675 $y_pos = $this->blk[$blvl][
'background-image'][
'y_pos'];
17676 $x_repeat = $this->blk[$blvl][
'background-image'][
'x_repeat'];
17677 $y_repeat = $this->blk[$blvl][
'background-image'][
'y_repeat'];
17678 $resize = $this->blk[$blvl][
'background-image'][
'resize'];
17679 $opacity = $this->blk[$blvl][
'background-image'][
'opacity'];
17680 $itype = $this->blk[$blvl][
'background-image'][
'itype'];
17681 $size = $this->blk[$blvl][
'background-image'][
'size'];
17684 $bpa = [
'x' => $x0,
'y' => $y0,
'w' => $w,
'h' => $h];
17686 if ($this->blk[$blvl][
'background-image'][
'origin'] ==
'padding-box') {
17688 $bpa[
'x'] = $x0 + $this->blk[$blvl][
'border_left'][
'w'];
17689 $bpa[
'w'] = $w - ($this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'border_right'][
'w']);
17690 if ($this->blk[$blvl][
'border_top'] && $divider !=
'pagetop' && !$continuingpage) {
17691 $bpa[
'y'] = $y0 + $this->blk[$blvl][
'border_top'][
'w'];
17695 if ($this->blk[$blvl][
'border_bottom'] && $blockstate != 1 && $divider !=
'pagebottom') {
17696 $bpay = $y1 - $this->blk[$blvl][
'border_bottom'][
'w'];
17700 $bpa[
'h'] = $bpay - $bpa[
'y'];
17702 } elseif ($this->blk[$blvl][
'background-image'][
'origin'] ==
'content-box') {
17704 $bpa[
'x'] = $x0 + $this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'padding_left'];
17705 $bpa[
'w'] = $w - ($this->blk[$blvl][
'border_left'][
'w'] + $this->blk[$blvl][
'padding_left'] + $this->blk[$blvl][
'border_right'][
'w'] + $this->blk[$blvl][
'padding_right']);
17706 if ($this->blk[$blvl][
'border_top'] && $divider !=
'pagetop' && !$continuingpage) {
17707 $bpa[
'y'] = $y0 + $this->blk[$blvl][
'border_top'][
'w'] + $this->blk[$blvl][
'padding_top'];
17709 $bpa[
'y'] = $y0 + $this->blk[$blvl][
'padding_top'];
17711 if ($this->blk[$blvl][
'border_bottom'] && $blockstate != 1 && $divider !=
'pagebottom') {
17712 $bpay = $y1 - ($this->blk[$blvl][
'border_bottom'][
'w'] + $this->blk[$blvl][
'padding_bottom']);
17714 $bpay = $y1 - $this->blk[$blvl][
'padding_bottom'];
17716 $bpa[
'h'] = $bpay - $bpa[
'y'];
17720 $this->pageBackgrounds[$blvl][] = [
17725 'image_id' => $image_id,
17726 'orig_w' => $orig_w,
17727 'orig_h' => $orig_h,
17730 'x_repeat' => $x_repeat,
17731 'y_repeat' => $y_repeat,
17733 'resize' => $resize,
17734 'opacity' => $opacity,
17736 'visibility' => $this->visibility,
17737 'z-index' => $this->current_layer,
17746 $this->blk[$blvl][
'bb_painted'][$this->page] =
true;
17750 function _EllipseArc($x0, $y0, $rx, $ry, $seg = 1, $part =
false, $start =
false)
17763 $rx *= Mpdf::SCALE;
17764 $ry *= Mpdf::SCALE;
17771 } elseif ($seg == 2) {
17774 } elseif ($seg == 3) {
17782 $astart = deg2rad((
float) $astart);
17783 $afinish = deg2rad((
float) $afinish);
17785 $totalAngle = $afinish - $astart;
17786 $dt = $totalAngle / $nSeg;
17788 $x0 *= Mpdf::SCALE;
17789 $y0 = ($this->h - $y0) * Mpdf::SCALE;
17791 $a0 = $x0 + ($rx * cos($t1));
17792 $b0 = $y0 + ($ry * sin($t1));
17793 $c0 = -$rx * sin($t1);
17794 $d0 = $ry * cos($t1);
17797 for ($i = 1; $i <= $nSeg; $i++) {
17799 $t1 = ($i * $dt) + $astart;
17800 $a1 = $x0 + ($rx * cos($t1));
17801 $b1 = $y0 + ($ry * sin($t1));
17802 $c1 = -$rx * sin($t1);
17803 $d1 = $ry * cos($t1);
17804 if ($i > ($nSeg - 4) && (!$part || ($part == 1 && $i <= $nSeg - 2) || ($part == 2 && $i > $nSeg - 2))) {
17805 if ($start && !$op) {
17806 $s .= sprintf(
'%.3F %.3F m ', $a0, $b0);
17808 $s .= sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c ', ($a0 + ($c0 * $dtm)), ($b0 + ($d0 * $dtm)), ($a1 - ($c1 * $dtm)), ($b1 - ($d1 * $dtm)), $a1, $b1);
17825 $this->ColDetails[$this->CurrCol][
'bottom_margin'] = $this->y + $h;
17827 $save_y = $this->y;
17829 $w = $this->blk[$blvl][
'width'];
17832 $x1 = $this->x + $w;
17833 $y1 = $this->y + $h;
17834 $continuingpage = (isset($this->blk[$blvl][
'startpage']) && $this->blk[$blvl][
'startpage'] != $this->page);
17836 if ($this->blk[$blvl][
'border_top'] && ($state == 1 || $state == 3)) {
17837 $tbd = $this->blk[$blvl][
'border_top'];
17838 if (isset($tbd[
's']) && $tbd[
's']) {
17839 $this->_setBorderLine($tbd);
17840 $this->y = $y0 + ($tbd[
'w'] / 2);
17841 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17842 $this->_setDashBorder($tbd[
'style'],
'', $continuingpage,
'T');
17843 $this->Line($x0 + ($tbd[
'w'] / 2), $this->y, $x0 + $w - ($tbd[
'w'] / 2), $this->y);
17845 $this->SetLineJoin(0);
17846 $this->SetLineCap(0);
17847 $this->Line($x0, $this->y, $x0 + $w, $this->y);
17849 $this->y += $tbd[
'w'];
17851 $this->SetLineJoin(2);
17852 $this->SetLineCap(2);
17856 if ($this->blk[$blvl][
'border_left']) {
17857 $tbd = $this->blk[$blvl][
'border_left'];
17858 if (isset($tbd[
's']) && $tbd[
's']) {
17859 $this->_setBorderLine($tbd);
17860 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17861 $this->y = $y0 + ($tbd[
'w'] / 2);
17862 $this->_setDashBorder($tbd[
'style'],
'', $continuingpage,
'L');
17863 $this->Line($x0 + ($tbd[
'w'] / 2), $this->y, $x0 + ($tbd[
'w'] / 2), $y0 + $h - ($tbd[
'w'] / 2));
17866 $this->SetLineJoin(0);
17867 $this->SetLineCap(0);
17868 $this->Line($x0 + ($tbd[
'w'] / 2), $this->y, $x0 + ($tbd[
'w'] / 2), $y0 + $h);
17870 $this->y += $tbd[
'w'];
17872 $this->SetLineJoin(2);
17873 $this->SetLineCap(2);
17877 if ($this->blk[$blvl][
'border_right']) {
17878 $tbd = $this->blk[$blvl][
'border_right'];
17879 if (isset($tbd[
's']) && $tbd[
's']) {
17880 $this->_setBorderLine($tbd);
17881 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17882 $this->y = $y0 + ($tbd[
'w'] / 2);
17883 $this->_setDashBorder($tbd[
'style'],
'', $continuingpage,
'R');
17884 $this->Line($x0 + $w - ($tbd[
'w'] / 2), $this->y, $x0 + $w - ($tbd[
'w'] / 2), $y0 + $h - ($tbd[
'w'] / 2));
17887 $this->SetLineJoin(0);
17888 $this->SetLineCap(0);
17889 $this->Line($x0 + $w - ($tbd[
'w'] / 2), $this->y, $x0 + $w - ($tbd[
'w'] / 2), $y0 + $h);
17891 $this->y += $tbd[
'w'];
17893 $this->SetLineJoin(2);
17894 $this->SetLineCap(2);
17898 if ($this->blk[$blvl][
'border_bottom'] && $state > 1) {
17899 $tbd = $this->blk[$blvl][
'border_bottom'];
17900 if (isset($tbd[
's']) && $tbd[
's']) {
17901 $this->_setBorderLine($tbd);
17902 $this->y = $y0 + $h - ($tbd[
'w'] / 2);
17903 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17904 $this->_setDashBorder($tbd[
'style'],
'', $continuingpage,
'B');
17905 $this->Line($x0 + ($tbd[
'w'] / 2), $this->y, $x0 + $w - ($tbd[
'w'] / 2), $this->y);
17907 $this->SetLineJoin(0);
17908 $this->SetLineCap(0);
17909 $this->Line($x0, $this->y, $x0 + $w, $this->y);
17911 $this->y += $tbd[
'w'];
17913 $this->SetLineJoin(2);
17914 $this->SetLineCap(2);
17919 $this->y = $save_y;
17925 if ($this->ColActive) {
17929 $k = $this->shrin_k;
17933 $h = (isset($objattr[
'BORDER-HEIGHT']) ? $objattr[
'BORDER-HEIGHT'] : 0);
17934 $w = (isset($objattr[
'BORDER-WIDTH']) ? $objattr[
'BORDER-WIDTH'] : 0);
17935 $x0 = (isset($objattr[
'BORDER-X']) ? $objattr[
'BORDER-X'] : 0);
17936 $y0 = (isset($objattr[
'BORDER-Y']) ? $objattr[
'BORDER-Y'] : 0);
17939 if ($objattr[
'border_top']) {
17940 $tbd = $objattr[
'border_top'];
17941 if (!empty($tbd[
's'])) {
17942 $this->_setBorderLine($tbd, $k);
17943 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17944 $this->_setDashBorder($tbd[
'style'],
'',
'',
'T');
17946 $this->Line($x0, $y0, $x0 + $w, $y0);
17948 $this->SetLineJoin(2);
17949 $this->SetLineCap(2);
17953 if ($objattr[
'border_left']) {
17954 $tbd = $objattr[
'border_left'];
17955 if (!empty($tbd[
's'])) {
17956 $this->_setBorderLine($tbd, $k);
17957 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17958 $this->_setDashBorder($tbd[
'style'],
'',
'',
'L');
17960 $this->Line($x0, $y0, $x0, $y0 + $h);
17962 $this->SetLineJoin(2);
17963 $this->SetLineCap(2);
17967 if ($objattr[
'border_right']) {
17968 $tbd = $objattr[
'border_right'];
17969 if (!empty($tbd[
's'])) {
17970 $this->_setBorderLine($tbd, $k);
17971 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17972 $this->_setDashBorder($tbd[
'style'],
'',
'',
'R');
17974 $this->Line($x0 + $w, $y0, $x0 + $w, $y0 + $h);
17976 $this->SetLineJoin(2);
17977 $this->SetLineCap(2);
17981 if ($objattr[
'border_bottom']) {
17982 $tbd = $objattr[
'border_bottom'];
17983 if (!empty($tbd[
's'])) {
17984 $this->_setBorderLine($tbd, $k);
17985 if ($tbd[
'style'] ==
'dotted' || $tbd[
'style'] ==
'dashed') {
17986 $this->_setDashBorder($tbd[
'style'],
'',
'',
'B');
17988 $this->Line($x0, $y0 + $h, $x0 + $w, $y0 + $h);
17990 $this->SetLineJoin(2);
17991 $this->SetLineCap(2);
17996 $this->SetAlpha(1);
18003 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
18004 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
18005 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
18006 $this->SetAlpha(1);
18007 $this->colorarray =
'';
18009 $this->spanbgcolorarray =
'';
18010 $this->spanbgcolor =
false;
18011 $this->spanborder =
false;
18012 $this->spanborddet = [];
18014 $this->ResetStyles();
18017 $this->textparam = [];
18018 $this->SetTextOutline();
18020 $this->textvar = 0x00;
18021 $this->OTLtags = [];
18022 $this->textshadow =
'';
18024 $this->currentLang = $this->default_lang;
18025 $this->RestrictUnicodeFonts($this->default_available_fonts);
18026 $this->
SetFont($this->default_font,
'', 0,
false);
18027 $this->
SetFontSize($this->default_font_size,
false);
18029 $this->currentfontfamily =
'';
18030 $this->currentfontsize =
'';
18031 $this->currentfontstyle =
'';
18033 if ($this->tableLevel && isset($this->table[1][1][
'cellLineHeight'])) {
18034 $this->SetLineHeight(
'', $this->table[1][1][
'cellLineHeight']);
18036 if (isset($this->blk[$this->blklvl][
'line_height']) && $this->blk[$this->blklvl][
'line_height']) {
18037 $this->SetLineHeight(
'', $this->blk[$this->blklvl][
'line_height']);
18041 $this->lSpacingCSS =
'';
18042 $this->wSpacingCSS =
'';
18043 $this->fixedlSpacing =
false;
18044 $this->minwSpacing = 0;
18046 $this->dash_on =
false;
18047 $this->dotted_on =
false;
18048 $this->divwidth = 0;
18049 $this->divheight = 0;
18050 $this->cellTextAlign =
'';
18051 $this->cellLineHeight =
'';
18052 $this->cellLineStackingStrategy =
'';
18053 $this->cellLineStackingShift =
'';
18058 if (isset($this->cssManager->CSS[
'BODY'][
'FONT-STYLE'])) {
18059 $bodystyle[
'FONT-STYLE'] = $this->cssManager->CSS[
'BODY'][
'FONT-STYLE'];
18062 if (isset($this->cssManager->CSS[
'BODY'][
'FONT-WEIGHT'])) {
18063 $bodystyle[
'FONT-WEIGHT'] = $this->cssManager->CSS[
'BODY'][
'FONT-WEIGHT'];
18066 if (isset($this->cssManager->CSS[
'BODY'][
'COLOR'])) {
18067 $bodystyle[
'COLOR'] = $this->cssManager->CSS[
'BODY'][
'COLOR'];
18070 if (isset($bodystyle)) {
18071 $this->setCSS($bodystyle,
'BLOCK',
'BODY');
18080 $regexp =
'/ (\\w+?)=([^\\s>"]+)/si';
18081 $html = preg_replace($regexp,
" \$1=\"\$2\"",
$html);
18082 if (preg_match(
'/<title>(.*?)<\/title>/si',
$html, $m)) {
18083 $this->SetTitle($m[1]);
18085 preg_match_all(
'/<meta [^>]*?(name|content)="([^>]*?)" [^>]*?(name|content)="([^>]*?)".*?>/si',
$html, $aux);
18086 $firstattr = $aux[1];
18087 $secondattr = $aux[3];
18088 for ($i = 0; $i < count($aux[0]); $i++) {
18089 $name = ( strtoupper($firstattr[$i]) ==
"NAME" ) ? strtoupper($aux[2][$i]) : strtoupper($aux[4][$i]);
18090 $content = ( strtoupper($firstattr[$i]) ==
"CONTENT" ) ? $aux[2][$i] : $aux[4][$i];
18093 $this->SetKeywords($content);
18096 $this->SetAuthor($content);
18098 case "DESCRIPTION":
18099 $this->SetSubject($content);
18108 if ($this->allow_charset_conversion) {
18109 if (preg_match(
'/<head.*charset=([^\'\"\s]*).*<\/head>/si',
$html, $m)) {
18110 if (strtoupper($m[1]) !=
'UTF-8') {
18111 $this->charset_in = strtoupper($m[1]);
18117 function setCSS($arrayaux, $type =
'', $tag =
'')
18120 if (!is_array($arrayaux)) {
18125 $preceeding_fontkey = $this->FontFamily . $this->FontStyle;
18126 $preceeding_fontsize = $this->FontSize;
18127 $spanbordset =
false;
18128 $spanbgset =
false;
18130 $prevlevel = (($this->blklvl == 0) ? 0 : $this->blklvl - 1);
18133 if (isset($arrayaux[
'FONT-SIZE'])) {
18134 $v = $arrayaux[
'FONT-SIZE'];
18135 $firstLetter = substr($v, 0, 1);
18136 if (is_numeric($firstLetter) || ($firstLetter ===
'.')) {
18137 if ($type ==
'BLOCK' && $this->blklvl > 0 && isset($this->blk[$this->blklvl - 1][
'InlineProperties']) && isset($this->blk[$this->blklvl - 1][
'InlineProperties'][
'size'])) {
18138 $mmsize = $this->sizeConverter->convert($v, $this->blk[$this->blklvl - 1][
'InlineProperties'][
'size']);
18139 } elseif ($type ==
'TABLECELL') {
18140 $mmsize = $this->sizeConverter->convert($v, $this->default_font_size / Mpdf::SCALE);
18142 $mmsize = $this->sizeConverter->convert($v, $this->FontSize);
18144 $this->
SetFontSize($mmsize * (Mpdf::SCALE),
false);
18146 $v = strtoupper($v);
18147 if (isset($this->fontsizes[$v])) {
18148 $this->
SetFontSize($this->fontsizes[$v] * $this->default_font_size,
false);
18151 if ($tag ==
'BODY') {
18152 $this->SetDefaultFontSize($this->FontSizePt);
18157 if (isset($arrayaux[
'LANG']) && $arrayaux[
'LANG']) {
18158 if ($this->autoLangToFont && !$this->usingCoreFont) {
18159 if ($arrayaux[
'LANG'] != $this->default_lang && $arrayaux[
'LANG'] !=
'UTF-8') {
18160 list ($coreSuitable, $mpdf_pdf_unifont) = $this->languageToFont->getLanguageOptions($arrayaux[
'LANG'], $this->useAdobeCJK);
18161 if ($mpdf_pdf_unifont) {
18162 $arrayaux[
'FONT-FAMILY'] = $mpdf_pdf_unifont;
18164 if ($tag ==
'BODY') {
18165 $this->default_lang = $arrayaux[
'LANG'];
18169 $this->currentLang = $arrayaux[
'LANG'];
18173 if (isset($arrayaux[
'FONT-FAMILY'])) {
18174 $v = $arrayaux[
'FONT-FAMILY'];
18176 $aux_fontlist = explode(
",", $v);
18178 foreach ($aux_fontlist as $f) {
18179 $fonttype = trim($f);
18180 $fonttype = preg_replace(
'/["\']*(.*?)["\']*/',
'\\1', $fonttype);
18181 $fonttype = preg_replace(
'/ /',
'', $fonttype);
18182 $v = strtolower(trim($fonttype));
18183 if (isset($this->fonttrans[$v]) && $this->fonttrans[$v]) {
18184 $v = $this->fonttrans[$v];
18186 if ((!$this->onlyCoreFonts && in_array($v, $this->available_unifonts)) ||
18187 in_array($v, [
'ccourier',
'ctimes',
'chelvetica']) ||
18188 ($this->onlyCoreFonts && in_array($v, [
'courier',
'times',
'helvetica',
'arial'])) ||
18189 in_array($v, [
'sjis',
'uhc',
'big5',
'gb'])) {
18196 foreach ($aux_fontlist as $f) {
18197 $fonttype = trim($f);
18198 $fonttype = preg_replace(
'/["\']*(.*?)["\']*/',
'\\1', $fonttype);
18199 $fonttype = preg_replace(
'/ /',
'', $fonttype);
18200 $v = strtolower(trim($fonttype));
18201 if (isset($this->fonttrans[$v]) && $this->fonttrans[$v]) {
18202 $v = $this->fonttrans[$v];
18204 if (in_array($v, $this->sans_fonts) || in_array($v, $this->serif_fonts) || in_array($v, $this->mono_fonts)) {
18211 if ($tag ==
'BODY') {
18212 $this->SetDefaultFont($fonttype);
18214 $this->
SetFont($fonttype, $this->currentfontstyle, 0,
false);
18216 $this->
SetFont($this->currentfontfamily, $this->currentfontstyle, 0,
false);
18219 foreach ($arrayaux as $k => $v) {
18220 if ($type !=
'INLINE' && $tag !=
'BODY' && $type !=
'TABLECELL') {
18224 $this->blk[$this->blklvl][
'border_top'] = $this->border_details($v);
18225 if ($this->blk[$this->blklvl][
'border_top'][
's']) {
18226 $this->blk[$this->blklvl][
'border'] = 1;
18229 case 'BORDER-BOTTOM':
18230 $this->blk[$this->blklvl][
'border_bottom'] = $this->border_details($v);
18231 if ($this->blk[$this->blklvl][
'border_bottom'][
's']) {
18232 $this->blk[$this->blklvl][
'border'] = 1;
18235 case 'BORDER-LEFT':
18236 $this->blk[$this->blklvl][
'border_left'] = $this->border_details($v);
18237 if ($this->blk[$this->blklvl][
'border_left'][
's']) {
18238 $this->blk[$this->blklvl][
'border'] = 1;
18241 case 'BORDER-RIGHT':
18242 $this->blk[$this->blklvl][
'border_right'] = $this->border_details($v);
18243 if ($this->blk[$this->blklvl][
'border_right'][
's']) {
18244 $this->blk[$this->blklvl][
'border'] = 1;
18249 case 'PADDING-TOP':
18250 $this->blk[$this->blklvl][
'padding_top'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18252 case 'PADDING-BOTTOM':
18253 $this->blk[$this->blklvl][
'padding_bottom'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18255 case 'PADDING-LEFT':
18256 if (($tag ==
'UL' || $tag ==
'OL') && $v ==
'auto') {
18257 $this->blk[$this->blklvl][
'padding_left'] =
'auto';
18260 $this->blk[$this->blklvl][
'padding_left'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18262 case 'PADDING-RIGHT':
18263 if (($tag ==
'UL' || $tag ==
'OL') && $v ==
'auto') {
18264 $this->blk[$this->blklvl][
'padding_right'] =
'auto';
18267 $this->blk[$this->blklvl][
'padding_right'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18272 $tmp = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18273 if (isset($this->blk[$this->blklvl][
'lastbottommargin'])) {
18274 if ($tmp > $this->blk[$this->blklvl][
'lastbottommargin']) {
18275 $tmp -= $this->blk[$this->blklvl][
'lastbottommargin'];
18280 $this->blk[$this->blklvl][
'margin_top'] = $tmp;
18282 case 'MARGIN-BOTTOM':
18283 $this->blk[$this->blklvl][
'margin_bottom'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18285 case 'MARGIN-LEFT':
18286 $this->blk[$this->blklvl][
'margin_left'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18288 case 'MARGIN-RIGHT':
18289 $this->blk[$this->blklvl][
'margin_right'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18293 case 'BORDER-TOP-LEFT-RADIUS-H':
18294 $this->blk[$this->blklvl][
'border_radius_TL_H'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18296 case 'BORDER-TOP-LEFT-RADIUS-V':
18297 $this->blk[$this->blklvl][
'border_radius_TL_V'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18299 case 'BORDER-TOP-RIGHT-RADIUS-H':
18300 $this->blk[$this->blklvl][
'border_radius_TR_H'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18302 case 'BORDER-TOP-RIGHT-RADIUS-V':
18303 $this->blk[$this->blklvl][
'border_radius_TR_V'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18305 case 'BORDER-BOTTOM-LEFT-RADIUS-H':
18306 $this->blk[$this->blklvl][
'border_radius_BL_H'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18308 case 'BORDER-BOTTOM-LEFT-RADIUS-V':
18309 $this->blk[$this->blklvl][
'border_radius_BL_V'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18311 case 'BORDER-BOTTOM-RIGHT-RADIUS-H':
18312 $this->blk[$this->blklvl][
'border_radius_BR_H'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18314 case 'BORDER-BOTTOM-RIGHT-RADIUS-V':
18315 $this->blk[$this->blklvl][
'border_radius_BR_V'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18320 $bs = $this->cssManager->setCSSboxshadow($v);
18322 $this->blk[$this->blklvl][
'box_shadow'] = $bs;
18326 case 'BACKGROUND-CLIP':
18327 if (strtoupper($v) ==
'PADDING-BOX') {
18328 $this->blk[$this->blklvl][
'background_clip'] =
'padding-box';
18329 } elseif (strtoupper($v) ==
'CONTENT-BOX') {
18330 $this->blk[$this->blklvl][
'background_clip'] =
'content-box';
18334 case 'PAGE-BREAK-AFTER':
18335 if (strtoupper($v) ==
'AVOID') {
18336 $this->blk[$this->blklvl][
'page_break_after_avoid'] =
true;
18337 } elseif (strtoupper($v) ==
'ALWAYS' || strtoupper($v) ==
'LEFT' || strtoupper($v) ==
'RIGHT') {
18338 $this->blk[$this->blklvl][
'page_break_after'] = strtoupper($v);
18343 case 'BOX-DECORATION-BREAK':
18344 if (strtoupper($v) ==
'CLONE') {
18345 $this->blk[$this->blklvl][
'box_decoration_break'] =
'clone';
18346 } elseif (strtoupper($v) ==
'SLICE') {
18347 $this->blk[$this->blklvl][
'box_decoration_break'] =
'slice';
18352 if (strtoupper($v) !=
'AUTO') {
18353 $this->blk[$this->blklvl][
'css_set_width'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false);
18359 case 'LIST-STYLE-TYPE':
18360 $this->blk[$this->blklvl][
'list_style_type'] = strtolower($v);
18362 case 'LIST-STYLE-IMAGE':
18363 $this->blk[$this->blklvl][
'list_style_image'] = strtolower($v);
18365 case 'LIST-STYLE-POSITION':
18366 $this->blk[$this->blklvl][
'list_style_position'] = strtolower($v);
18372 if ($type !=
'INLINE' && $type !=
'TABLECELL') {
18374 case 'TEXT-INDENT':
18376 $this->blk[$this->blklvl][
'text_indent'] = $this->sizeConverter->convert($v, $this->blk[$prevlevel][
'inner_width'], $this->FontSize,
false) .
'mm';
18379 case 'MARGIN-COLLAPSE':
18380 if (strtoupper($v) ==
'COLLAPSE') {
18381 $this->blk[$this->blklvl][
'margin_collapse'] =
true;
18385 case 'LINE-HEIGHT':
18386 $this->blk[$this->blklvl][
'line_height'] = $this->fixLineheight($v);
18387 if (!$this->blk[$this->blklvl][
'line_height']) {
18388 $this->blk[$this->blklvl][
'line_height'] =
'N';
18393 case 'LINE-STACKING-STRATEGY':
18394 $this->blk[$this->blklvl][
'line_stacking_strategy'] = strtolower($v);
18397 case 'LINE-STACKING-SHIFT':
18398 $this->blk[$this->blklvl][
'line_stacking_shift'] = strtolower($v);
18402 switch (strtoupper($v)) {
18404 $this->blk[$this->blklvl][
'align'] =
"L";
18407 $this->blk[$this->blklvl][
'align'] =
"C";
18410 $this->blk[$this->blklvl][
'align'] =
"R";
18413 $this->blk[$this->blklvl][
'align'] =
"J";
18419 case 'BACKGROUND-GRADIENT':
18420 if ($type ==
'BLOCK') {
18421 $this->blk[$this->blklvl][
'gradient'] = $v;
18428 $this->blk[$this->blklvl][
'direction'] = strtolower($v);
18435 if ($type ==
'INLINE') {
18438 if (strtoupper($v) ==
'NONE') {
18439 $this->inlineDisplayOff =
true;
18447 if ($type ==
'INLINE') {
18451 $this->spanborddet[
'T'] = $this->border_details($v);
18452 $this->spanborder =
true;
18453 $spanbordset =
true;
18455 case 'BORDER-BOTTOM':
18456 $this->spanborddet[
'B'] = $this->border_details($v);
18457 $this->spanborder =
true;
18458 $spanbordset =
true;
18460 case 'BORDER-LEFT':
18461 $this->spanborddet[
'L'] = $this->border_details($v);
18462 $this->spanborder =
true;
18463 $spanbordset =
true;
18465 case 'BORDER-RIGHT':
18466 $this->spanborddet[
'R'] = $this->border_details($v);
18467 $this->spanborder =
true;
18468 $spanbordset =
true;
18471 $v = strtolower($v);
18472 if ($v ==
'visible' || $v ==
'hidden' || $v ==
'printonly' || $v ==
'screenonly') {
18473 $this->textparam[
'visibility'] = $v;
18479 if ($type !=
'TABLECELL') {
18483 if (strtoupper($v) ==
'NOJUSTIFY' && $this->blk[$this->blklvl][
'align'] ==
"J") {
18484 $this->blk[$this->blklvl][
'align'] =
"";
18489 case 'BACKGROUND-COLOR':
18490 $cor = $this->colorConverter->convert($v, $this->PDFAXwarnings);
18492 if ($tag ==
'BODY') {
18493 $this->bodyBackgroundColor = $cor;
18494 } elseif ($type ==
'INLINE') {
18495 $this->spanbgcolorarray = $cor;
18496 $this->spanbgcolor =
true;
18499 $this->blk[$this->blklvl][
'bgcolorarray'] = $cor;
18500 $this->blk[$this->blklvl][
'bgcolor'] =
true;
18502 } elseif ($type !=
'INLINE') {
18503 if ($this->ColActive) {
18504 $this->blk[$this->blklvl][
'bgcolorarray'] = $this->blk[$prevlevel][
'bgcolorarray'];
18505 $this->blk[$this->blklvl][
'bgcolor'] = $this->blk[$prevlevel][
'bgcolor'];
18510 case 'VERTICAL-ALIGN':
18511 switch (strtoupper($v)) {
18514 $this->textvar = ($this->textvar &
~TextVars::FA_SUBSCRIPT);
18516 if (isset($this->textparam[
'text-baseline'])) {
18517 $this->textparam[
'text-baseline'] += ($this->baselineSup) * $preceeding_fontsize;
18519 $this->textparam[
'text-baseline'] = ($this->baselineSup) * $preceeding_fontsize;
18524 $this->textvar = ($this->textvar &
~TextVars::FA_SUPERSCRIPT);
18526 if (isset($this->textparam[
'text-baseline'])) {
18527 $this->textparam[
'text-baseline'] += ($this->baselineSub) * $preceeding_fontsize;
18529 $this->textparam[
'text-baseline'] = ($this->baselineSub) * $preceeding_fontsize;
18533 $this->textvar = ($this->textvar &
~TextVars::FA_SUBSCRIPT);
18534 $this->textvar = ($this->textvar &
~TextVars::FA_SUPERSCRIPT);
18536 if (isset($this->textparam[
'text-baseline'])) {
18537 unset($this->textparam[
'text-baseline']);
18542 $lh = $this->_computeLineheight($this->blk[$this->blklvl][
'line_height']);
18543 $sz = $this->sizeConverter->convert($v, $lh, $this->FontSize,
false);
18544 $this->textvar = ($this->textvar &
~TextVars::FA_SUBSCRIPT);
18545 $this->textvar = ($this->textvar &
~TextVars::FA_SUPERSCRIPT);
18552 if (isset($this->textparam[
'text-baseline'])) {
18553 $this->textparam[
'text-baseline'] += $sz;
18555 $this->textparam[
'text-baseline'] = $sz;
18566 case 'LETTER-SPACING':
18567 $this->lSpacingCSS = $v;
18568 if (($this->lSpacingCSS || $this->lSpacingCSS ===
'0') && strtoupper($this->lSpacingCSS) !=
'NORMAL') {
18569 $this->fixedlSpacing = $this->sizeConverter->convert($this->lSpacingCSS, $this->FontSize);
18573 case 'WORD-SPACING':
18574 $this->wSpacingCSS = $v;
18575 if ($this->wSpacingCSS && strtoupper($this->wSpacingCSS) !=
'NORMAL') {
18576 $this->minwSpacing = $this->sizeConverter->convert($this->wSpacingCSS, $this->FontSize);
18581 switch (strtoupper($v)) {
18584 $this->SetStyle(
'I',
true);
18587 $this->SetStyle(
'I',
false);
18592 case 'FONT-WEIGHT':
18593 switch (strtoupper($v)) {
18595 $this->SetStyle(
'B',
true);
18598 $this->SetStyle(
'B',
false);
18603 case 'FONT-KERNING':
18604 if (strtoupper($v) ==
'NORMAL' || (strtoupper($v) ==
'AUTO' && $this->useKerning)) {
18606 if ($this->CurrentFont[
'haskernGPOS']) {
18607 if (isset($this->OTLtags[
'Plus'])) {
18608 $this->OTLtags[
'Plus'] .=
' kern';
18610 $this->OTLtags[
'Plus'] =
' kern';
18615 } elseif (strtoupper($v) ==
'NONE' || (strtoupper($v) ==
'AUTO' && !$this->useKerning)) {
18616 if (isset($this->OTLtags[
'Plus'])) {
18617 $this->OTLtags[
'Plus'] = str_replace(
'kern',
'', $this->OTLtags[
'Plus']);
18619 if (isset($this->OTLtags[
'FFPlus'])) {
18620 $this->OTLtags[
'FFPlus'] = preg_replace(
'/kern[\d]*/',
'', $this->OTLtags[
'FFPlus']);
18622 $this->textvar = ($this->textvar &
~TextVars::FC_KERNING);
18627 case 'FONT-LANGUAGE-OVERRIDE':
18628 $v = strtoupper($v);
18629 if (strpos($v,
'NORMAL') !==
false) {
18630 $this->fontLanguageOverride =
'';
18632 $this->fontLanguageOverride = trim($v);
18637 case 'FONT-VARIANT-POSITION':
18638 if (isset($this->OTLtags[
'Plus'])) {
18639 $this->OTLtags[
'Plus'] = str_replace([
'sups',
'subs'],
'', $this->OTLtags[
'Plus']);
18641 switch (strtoupper($v)) {
18643 $this->OTLtags[
'Plus'] .=
' sups';
18646 $this->OTLtags[
'Plus'] .=
' subs';
18653 case 'FONT-VARIANT-CAPS':
18654 $v = strtoupper($v);
18655 if (!isset($this->OTLtags[
'Plus'])) {
18656 $this->OTLtags[
'Plus'] =
'';
18658 $this->OTLtags[
'Plus'] = str_replace([
'c2sc',
'smcp',
'c2pc',
'pcap',
'unic',
'titl'],
'', $this->OTLtags[
'Plus']);
18659 $this->textvar = ($this->textvar &
~TextVars::FC_SMALLCAPS);
18660 if (strpos($v,
'ALL-SMALL-CAPS') !==
false) {
18661 $this->OTLtags[
'Plus'] .=
' c2sc smcp';
18662 } elseif (strpos($v,
'SMALL-CAPS') !==
false) {
18663 if (isset($this->CurrentFont[
'hassmallcapsGSUB']) && $this->CurrentFont[
'hassmallcapsGSUB']) {
18664 $this->OTLtags[
'Plus'] .=
' smcp';
18668 } elseif (strpos($v,
'ALL-PETITE-CAPS') !==
false) {
18669 $this->OTLtags[
'Plus'] .=
' c2pc pcap';
18670 } elseif (strpos($v,
'PETITE-CAPS') !==
false) {
18671 $this->OTLtags[
'Plus'] .=
' pcap';
18672 } elseif (strpos($v,
'UNICASE') !==
false) {
18673 $this->OTLtags[
'Plus'] .=
' unic';
18674 } elseif (strpos($v,
'TITLING-CAPS') !==
false) {
18675 $this->OTLtags[
'Plus'] .=
' titl';
18679 case 'FONT-VARIANT-LIGATURES':
18680 $v = strtoupper($v);
18681 if (!isset($this->OTLtags[
'Plus'])) {
18682 $this->OTLtags[
'Plus'] =
'';
18684 if (!isset($this->OTLtags[
'Minus'])) {
18685 $this->OTLtags[
'Minus'] =
'';
18687 if (strpos($v,
'NORMAL') !==
false) {
18688 $this->OTLtags[
'Minus'] = str_replace([
'liga',
'clig',
'calt'],
'', $this->OTLtags[
'Minus']);
18689 $this->OTLtags[
'Plus'] = str_replace([
'dlig',
'hlig'],
'', $this->OTLtags[
'Plus']);
18690 } elseif (strpos($v,
'NONE') !==
false) {
18691 $this->OTLtags[
'Minus'] .=
' liga clig calt';
18692 $this->OTLtags[
'Plus'] = str_replace([
'dlig',
'hlig'],
'', $this->OTLtags[
'Plus']);
18694 if (strpos($v,
'NO-COMMON-LIGATURES') !==
false) {
18695 $this->OTLtags[
'Minus'] .=
' liga clig';
18696 } elseif (strpos($v,
'COMMON-LIGATURES') !==
false) {
18697 $this->OTLtags[
'Minus'] = str_replace([
'liga',
'clig'],
'', $this->OTLtags[
'Minus']);
18699 if (strpos($v,
'NO-CONTEXTUAL') !==
false) {
18700 $this->OTLtags[
'Minus'] .=
' calt';
18701 } elseif (strpos($v,
'CONTEXTUAL') !==
false) {
18702 $this->OTLtags[
'Minus'] = str_replace(
'calt',
'', $this->OTLtags[
'Minus']);
18704 if (strpos($v,
'NO-DISCRETIONARY-LIGATURES') !==
false) {
18705 $this->OTLtags[
'Plus'] = str_replace(
'dlig',
'', $this->OTLtags[
'Plus']);
18706 } elseif (strpos($v,
'DISCRETIONARY-LIGATURES') !==
false) {
18707 $this->OTLtags[
'Plus'] .=
' dlig';
18709 if (strpos($v,
'NO-HISTORICAL-LIGATURES') !==
false) {
18710 $this->OTLtags[
'Plus'] = str_replace(
'hlig',
'', $this->OTLtags[
'Plus']);
18711 } elseif (strpos($v,
'HISTORICAL-LIGATURES') !==
false) {
18712 $this->OTLtags[
'Plus'] .=
' hlig';
18717 case 'FONT-VARIANT-NUMERIC':
18718 $v = strtoupper($v);
18719 if (!isset($this->OTLtags[
'Plus'])) {
18720 $this->OTLtags[
'Plus'] =
'';
18722 if (strpos($v,
'NORMAL') !==
false) {
18723 $this->OTLtags[
'Plus'] = str_replace([
'ordn',
'zero',
'lnum',
'onum',
'pnum',
'tnum',
'frac',
'afrc'],
'', $this->OTLtags[
'Plus']);
18725 if (strpos($v,
'ORDINAL') !==
false) {
18726 $this->OTLtags[
'Plus'] .=
' ordn';
18728 if (strpos($v,
'SLASHED-ZERO') !==
false) {
18729 $this->OTLtags[
'Plus'] .=
' zero';
18731 if (strpos($v,
'LINING-NUMS') !==
false) {
18732 $this->OTLtags[
'Plus'] .=
' lnum';
18733 $this->OTLtags[
'Plus'] = str_replace(
'onum',
'', $this->OTLtags[
'Plus']);
18734 } elseif (strpos($v,
'OLDSTYLE-NUMS') !==
false) {
18735 $this->OTLtags[
'Plus'] .=
' onum';
18736 $this->OTLtags[
'Plus'] = str_replace(
'lnum',
'', $this->OTLtags[
'Plus']);
18738 if (strpos($v,
'PROPORTIONAL-NUMS') !==
false) {
18739 $this->OTLtags[
'Plus'] .=
' pnum';
18740 $this->OTLtags[
'Plus'] = str_replace(
'tnum',
'', $this->OTLtags[
'Plus']);
18741 } elseif (strpos($v,
'TABULAR-NUMS') !==
false) {
18742 $this->OTLtags[
'Plus'] .=
' tnum';
18743 $this->OTLtags[
'Plus'] = str_replace(
'pnum',
'', $this->OTLtags[
'Plus']);
18745 if (strpos($v,
'DIAGONAL-FRACTIONS') !==
false) {
18746 $this->OTLtags[
'Plus'] .=
' frac';
18747 $this->OTLtags[
'Plus'] = str_replace(
'afrc',
'', $this->OTLtags[
'Plus']);
18748 } elseif (strpos($v,
'STACKED-FRACTIONS') !==
false) {
18749 $this->OTLtags[
'Plus'] .=
' afrc';
18750 $this->OTLtags[
'Plus'] = str_replace(
'frac',
'', $this->OTLtags[
'Plus']);
18754 case 'FONT-VARIANT-ALTERNATES':
18755 $v = strtoupper($v);
18756 if (!isset($this->OTLtags[
'Plus'])) {
18757 $this->OTLtags[
'Plus'] =
'';
18759 if (strpos($v,
'NORMAL') !==
false) {
18760 $this->OTLtags[
'Plus'] = str_replace(
'hist',
'', $this->OTLtags[
'Plus']);
18762 if (strpos($v,
'HISTORICAL-FORMS') !==
false) {
18763 $this->OTLtags[
'Plus'] .=
' hist';
18768 case 'FONT-FEATURE-SETTINGS':
18769 $v = strtolower($v);
18770 if (strpos($v,
'normal') !==
false) {
18771 $this->OTLtags[
'FFMinus'] =
'';
18772 $this->OTLtags[
'FFPlus'] =
'';
18774 if (!isset($this->OTLtags[
'FFPlus'])) {
18775 $this->OTLtags[
'FFPlus'] =
'';
18777 if (!isset($this->OTLtags[
'FFMinus'])) {
18778 $this->OTLtags[
'FFMinus'] =
'';
18780 $tags = preg_split(
'/[,]/', $v);
18781 foreach ($tags as $t) {
18782 if (preg_match(
'/[\"\']([a-zA-Z0-9]{4})[\"\']\s*(on|off|\d*){0,1}/', $t, $m)) {
18783 if ($m[2] ==
'off' || $m[2] ===
'0') {
18784 if (strpos($this->OTLtags[
'FFMinus'], $m[1]) ===
false) {
18785 $this->OTLtags[
'FFMinus'] .=
' ' . $m[1];
18787 $this->OTLtags[
'FFPlus'] = preg_replace(
'/' . $m[1] .
'[\d]*/',
'', $this->OTLtags[
'FFPlus']);
18789 if ($m[2] ==
'on') {
18792 if (strpos($this->OTLtags[
'FFPlus'], $m[1]) ===
false) {
18793 $this->OTLtags[
'FFPlus'] .=
' ' . $m[1] . $m[2];
18795 $this->OTLtags[
'FFMinus'] = str_replace($m[1],
'', $this->OTLtags[
'FFMinus']);
18804 case 'TEXT-TRANSFORM':
18805 switch (strtoupper($v)) {
18808 $this->textvar = ($this->textvar &
~TextVars::FT_UPPERCASE);
18809 $this->textvar = ($this->textvar &
~TextVars::FT_LOWERCASE);
18813 $this->textvar = ($this->textvar &
~TextVars::FT_LOWERCASE);
18814 $this->textvar = ($this->textvar &
~TextVars::FT_CAPITALIZE);
18818 $this->textvar = ($this->textvar &
~TextVars::FT_UPPERCASE);
18819 $this->textvar = ($this->textvar &
~TextVars::FT_CAPITALIZE);
18823 $this->textvar = ($this->textvar &
~TextVars::FT_UPPERCASE);
18824 $this->textvar = ($this->textvar &
~TextVars::FT_LOWERCASE);
18825 $this->textvar = ($this->textvar &
~TextVars::FT_CAPITALIZE);
18829 case 'TEXT-SHADOW':
18830 $ts = $this->cssManager->setCSStextshadow($v);
18832 $this->textshadow = $ts;
18837 if (strtoupper($v) ==
'NONE') {
18838 $this->textparam[
'hyphens'] = 2;
18839 } elseif (strtoupper($v) ==
'AUTO') {
18840 $this->textparam[
'hyphens'] = 1;
18841 } elseif (strtoupper($v) ==
'MANUAL') {
18842 $this->textparam[
'hyphens'] = 0;
18846 case 'TEXT-OUTLINE':
18847 if (strtoupper($v) ==
'NONE') {
18848 $this->textparam[
'outline-s'] =
false;
18852 case 'TEXT-OUTLINE-WIDTH':
18853 case 'OUTLINE-WIDTH':
18854 switch (strtoupper($v)) {
18865 $w = $this->sizeConverter->convert($v, $this->FontSize, $this->FontSize);
18867 $this->textparam[
'outline-WIDTH'] = $w;
18868 $this->textparam[
'outline-s'] =
true;
18870 $this->textparam[
'outline-s'] =
false;
18874 case 'TEXT-OUTLINE-COLOR':
18875 case 'OUTLINE-COLOR':
18876 if (strtoupper($v) ==
'INVERT') {
18877 if ($this->colorarray) {
18878 $cor = $this->colorarray;
18879 $this->textparam[
'outline-COLOR'] = $this->colorConverter->invert($cor);
18881 $this->textparam[
'outline-COLOR'] = $this->colorConverter->convert(255, $this->PDFAXwarnings);
18884 $cor = $this->colorConverter->convert($v, $this->PDFAXwarnings);
18886 $this->textparam[
'outline-COLOR'] = $cor;
18892 $cor = $this->colorConverter->convert($v, $this->PDFAXwarnings);
18894 $this->colorarray = $cor;
18895 $this->SetTColor($cor);
18902 if (isset($arrayaux[
'TEXT-DECORATION'])) {
18903 $v = $arrayaux[
'TEXT-DECORATION'];
18904 if (stristr($v,
'LINE-THROUGH')) {
18907 if (isset($this->textparam[
'text-baseline'])) {
18908 $this->textparam[
's-decoration'][
'baseline'] = $this->textparam[
'text-baseline'];
18910 $this->textparam[
's-decoration'][
'baseline'] = 0;
18912 $this->textparam[
's-decoration'][
'fontkey'] = $this->FontFamily . $this->FontStyle;
18913 $this->textparam[
's-decoration'][
'fontsize'] = $this->FontSize;
18914 $this->textparam[
's-decoration'][
'color'] = strtoupper($this->TextColor);
18916 if (stristr($v,
'UNDERLINE')) {
18919 if (isset($this->textparam[
'text-baseline'])) {
18920 $this->textparam[
'u-decoration'][
'baseline'] = $this->textparam[
'text-baseline'];
18922 $this->textparam[
'u-decoration'][
'baseline'] = 0;
18924 $this->textparam[
'u-decoration'][
'fontkey'] = $this->FontFamily . $this->FontStyle;
18925 $this->textparam[
'u-decoration'][
'fontsize'] = $this->FontSize;
18926 $this->textparam[
'u-decoration'][
'color'] = strtoupper($this->TextColor);
18928 if (stristr($v,
'OVERLINE')) {
18931 if (isset($this->textparam[
'text-baseline'])) {
18932 $this->textparam[
'o-decoration'][
'baseline'] = $this->textparam[
'text-baseline'];
18934 $this->textparam[
'o-decoration'][
'baseline'] = 0;
18936 $this->textparam[
'o-decoration'][
'fontkey'] = $this->FontFamily . $this->FontStyle;
18937 $this->textparam[
'o-decoration'][
'fontsize'] = $this->FontSize;
18938 $this->textparam[
'o-decoration'][
'color'] = strtoupper($this->TextColor);
18940 if (stristr($v,
'NONE')) {
18941 $this->textvar = ($this->textvar &
~TextVars::FD_UNDERLINE);
18942 $this->textvar = ($this->textvar &
~TextVars::FD_LINETHROUGH);
18943 $this->textvar = ($this->textvar &
~TextVars::FD_OVERLINE);
18945 if (isset($this->textparam[
'u-decoration'])) {
18946 unset($this->textparam[
'u-decoration']);
18948 if (isset($this->textparam[
's-decoration'])) {
18949 unset($this->textparam[
's-decoration']);
18951 if (isset($this->textparam[
'o-decoration'])) {
18952 unset($this->textparam[
'o-decoration']);
18957 if ($spanbordset) {
18958 if (isset($this->textparam[
'text-baseline'])) {
18959 $this->textparam[
'bord-decoration'][
'baseline'] = $this->textparam[
'text-baseline'];
18961 $this->textparam[
'bord-decoration'][
'baseline'] = 0;
18963 $this->textparam[
'bord-decoration'][
'fontkey'] = $this->FontFamily . $this->FontStyle;
18964 $this->textparam[
'bord-decoration'][
'fontsize'] = $this->FontSize;
18967 if (isset($this->textparam[
'text-baseline'])) {
18968 $this->textparam[
'bg-decoration'][
'baseline'] = $this->textparam[
'text-baseline'];
18970 $this->textparam[
'bg-decoration'][
'baseline'] = 0;
18972 $this->textparam[
'bg-decoration'][
'fontkey'] = $this->FontFamily . $this->FontStyle;
18973 $this->textparam[
'bg-decoration'][
'fontsize'] = $this->FontSize;
18981 $this->$tag = $enable;
18983 foreach ([
'B',
'I'] as $s) {
18988 $this->currentfontstyle = $style;
18989 $this->
SetFont(
'', $style, 0,
false);
18996 foreach ([
'B',
'I'] as $s) {
18997 if (isset($arr[$s])) {
19004 } elseif ($this->$s) {
19008 $this->currentfontstyle = $style;
19009 $this->
SetFont(
'', $style, 0,
false);
19016 foreach ([
'B',
'I'] as $s) {
19017 if (strpos($str, $s) !==
false) {
19024 $this->currentfontstyle = $style;
19025 $this->
SetFont(
'', $style, 0,
false);
19030 foreach ([
'B',
'I'] as $s) {
19033 $this->currentfontstyle =
'';
19034 $this->
SetFont(
'',
'', 0,
false);
19041 $this->enabledtags =
"<a><acronym><address><article><aside><b><bdi><bdo><big><blockquote><br><caption><center><cite><code><del><details><dd><div><dl><dt><em><fieldset><figcaption><figure><font><form><h1><h2><h3><h4><h5><h6><hgroup><hr><i><img><input><ins><kbd><legend><li><main><mark><meter><nav><ol><option><p><pre><progress><q><s><samp><section><select><small><span><strike><strong><sub><summary><sup><table><tbody><td><template><textarea><tfoot><th><thead><time><tr><tt><u><ul><var><footer><header><annotation><bookmark><textcircle><barcode><dottab><indexentry><indexinsert><watermarktext><watermarkimage><tts><ttz><tta><column_break><columnbreak><newcolumn><newpage><page_break><pagebreak><formfeed><columns><toc><tocentry><tocpagebreak><pageheader><pagefooter><setpageheader><setpagefooter><sethtmlpageheader><sethtmlpagefooter>";
19043 $str = explode(
",", $str);
19044 foreach ($str as $v) {
19045 $this->enabledtags = str_replace(trim($v),
'', $this->enabledtags);
19058 $toonarrow =
false;
19059 if ((count($textbuffer) == 0) or ( (count($textbuffer) == 1) && ($textbuffer[0][0] ==
''))) {
19063 foreach ($textbuffer as $chunk) {
19065 $OTLdata = (isset($chunk[18]) ? $chunk[18] :
null);
19068 if ($this->iterationCounter) {
19069 $line = preg_replace(
'/{iteration ([a-zA-Z0-9_]+)}/',
'\\1', $line);
19073 if (substr($line, 0, 3) ==
"\xbb\xa4\xac") {
19074 $objattr = $this->_getObjAttr($line);
19075 if ($objattr[
'type'] !=
'hr' && isset($objattr[
'width']) && ($objattr[
'width'] / $this->shrin_k) > ($maxwidth + 0.0001)) {
19076 if (($objattr[
'width'] / $this->shrin_k) > $biggestword) {
19077 $biggestword = ($objattr[
'width'] / $this->shrin_k);
19084 if ($line ==
"\n") {
19088 $line = trim($line);
19089 if (!empty($OTLdata)) {
19090 $this->otl->trimOTLdata($OTLdata,
true,
true);
19094 if (isset($chunk[11]) and $chunk[11] !=
'') {
19095 if ($this->shrin_k) {
19096 $this->
SetFontSize($chunk[11] / $this->shrin_k,
false);
19102 if (isset($chunk[4]) and $chunk[4] !=
'') {
19103 $font = $this->
SetFont($chunk[4], $this->FontStyle, 0,
false);
19106 if (isset($chunk[2]) and $chunk[2] !=
'') {
19107 $this->SetStyles($chunk[2]);
19111 if (isset($chunk[16]) && !empty($chunk[16])) {
19112 $this->spanborddet = $chunk[16];
19113 $lbw = (isset($this->spanborddet[
'L'][
'w']) ? $this->spanborddet[
'L'][
'w'] : 0);
19114 $rbw = (isset($this->spanborddet[
'R'][
'w']) ? $this->spanborddet[
'R'][
'w'] : 0);
19116 if (isset($chunk[15])) {
19117 $this->wSpacingCSS = $chunk[15];
19118 if ($this->wSpacingCSS && strtoupper($this->wSpacingCSS) !=
'NORMAL') {
19119 $this->minwSpacing = $this->sizeConverter->convert($this->wSpacingCSS, $this->FontSize) / $this->shrin_k;
19122 if (isset($chunk[14])) {
19123 $this->lSpacingCSS = $chunk[14];
19124 if (($this->lSpacingCSS || $this->lSpacingCSS ===
'0') && strtoupper($this->lSpacingCSS) !=
'NORMAL') {
19125 $this->fixedlSpacing = $this->sizeConverter->convert($this->lSpacingCSS, $this->FontSize) / $this->shrin_k;
19128 if (isset($chunk[8])) {
19129 $this->textvar = $chunk[8];
19134 if ($checkletter || (!preg_match(
'/(\xe2\x80\x8b| )/', trim($line)) && preg_match(
"/([" . $this->pregCJKchars .
"])/u", $line) )) {
19135 if (preg_match(
"/([" . $this->pregCJKchars .
"])/u", $line)) {
19141 $letters = preg_split(
'//u', $line);
19142 foreach ($letters as $k => $letter) {
19145 if (preg_match(
"/[" . $this->CJKleading .
"]/u", $letter) && $k > 0) {
19146 $letter = $letters[$k - 1] . $letter;
19148 if (preg_match(
"/[" . $this->CJKfollowing .
"]/u", $letter) && $k < (count($letters) - 1)) {
19149 $letter = $letter . $letters[$k + 1];
19153 $letterwidth = $this->GetStringWidth($letter,
false,
false, $chunk[8]);
19156 $letterwidth += $lbw;
19158 if ($k == (count($letters) - 1)) {
19159 $letterwidth += $rbw;
19163 if ($letterwidth > $maxwidth + 0.0001) {
19164 if ($letterwidth > $biggestword) {
19165 $biggestword = $letterwidth;
19173 $wordXAdvance = [];
19174 if (isset($chunk[18]) && $chunk[18]) {
19175 preg_match_all(
'/(\xe2\x80\x8b| )/', $line, $spaces, PREG_OFFSET_CAPTURE);
19178 foreach ($spaces[0] as $k => $m) {
19182 for ($n = $lastoffset; $n < $offset; $n++) {
19183 if (isset($chunk[18][
'GPOSinfo'][$n][
'XAdvanceL'])) {
19184 if (isset($wordXAdvance[$k])) {
19185 $wordXAdvance[$k] += $chunk[18][
'GPOSinfo'][$n][
'XAdvanceL'];
19187 $wordXAdvance[$k] = $chunk[18][
'GPOSinfo'][$n][
'XAdvanceL'];
19191 $lastoffset = $offset + 1;
19195 foreach ($chunk[18][
'GPOSinfo'] as $n => $gpos) {
19196 if ($n >= $lastoffset && isset($chunk[18][
'GPOSinfo'][$n][
'XAdvanceL'])) {
19197 if (isset($wordXAdvance[$k])) {
19198 $wordXAdvance[$k] += $chunk[18][
'GPOSinfo'][$n][
'XAdvanceL'];
19200 $wordXAdvance[$k] = $chunk[18][
'GPOSinfo'][$n][
'XAdvanceL'];
19206 $words = preg_split(
'/(\xe2\x80\x8b| )/', $line);
19207 foreach ($words as $k => $word) {
19208 $word = trim($word);
19209 $wordwidth = $this->GetStringWidth($word,
false,
false, $chunk[8]);
19211 if (isset($wordXAdvance[$k])) {
19212 $wordwidth += ($wordXAdvance[$k] * 1000 / $this->CurrentFont[
'unitsPerEm']) * ($this->FontSize / 1000);
19215 $wordwidth += $lbw;
19217 if ($k == (count($words) - 1)) {
19218 $wordwidth += $rbw;
19222 if (count($words) == 1 && substr($chunk[0], 0, 1) !=
' ') {
19223 $acclength += $wordwidth;
19224 } elseif (count($words) > 1 && $k == 0 && substr($chunk[0], 0, 1) !=
' ') {
19225 $acclength += $wordwidth;
19227 $acclength = $wordwidth;
19229 $acclongest = max($acclongest, $acclength);
19230 if (count($words) == 1 && substr($chunk[0], -1, 1) ==
' ') {
19232 } elseif (count($words) > 1 && ($k != (count($words) - 1) || substr($chunk[0], -1, 1) ==
' ')) {
19237 if ($wordwidth > $maxwidth + 0.0001) {
19238 if ($wordwidth > $biggestword) {
19239 $biggestword = $wordwidth;
19247 if ($acclongest > $maxwidth + 0.0001) {
19248 if ($acclongest > $biggestword) {
19249 $biggestword = $acclongest;
19257 if (isset($chunk[2]) and $chunk[2] !=
'') {
19258 $this->ResetStyles();
19260 if (isset($chunk[4]) and $chunk[4] !=
'') {
19261 $this->
SetFont($this->default_font, $this->FontStyle, 0,
false);
19263 if (isset($chunk[11]) and $chunk[11] !=
'') {
19264 $this->
SetFontSize($this->default_font_size,
false);
19266 $this->spanborddet = [];
19267 $this->textvar = 0x00;
19268 $this->OTLtags = [];
19269 $this->lSpacingCSS =
'';
19270 $this->wSpacingCSS =
'';
19271 $this->fixedlSpacing =
false;
19272 $this->minwSpacing = 0;
19277 if (($toonarrow) && ($this->table_error_report)) {
19278 throw new \Mpdf\MpdfException(
"Word is too long to fit in table - " . $this->table_error_report_param);
19281 return -$biggestword;
19289 $table[
'border_spacing_H'] /= $k;
19290 $table[
'border_spacing_V'] /= $k;
19292 $table[
'padding'][
'T'] /= $k;
19293 $table[
'padding'][
'R'] /= $k;
19294 $table[
'padding'][
'B'] /= $k;
19295 $table[
'padding'][
'L'] /= $k;
19297 $table[
'margin'][
'T'] /= $k;
19298 $table[
'margin'][
'R'] /= $k;
19299 $table[
'margin'][
'B'] /= $k;
19300 $table[
'margin'][
'L'] /= $k;
19302 $table[
'border_details'][
'T'][
'w'] /= $k;
19303 $table[
'border_details'][
'R'][
'w'] /= $k;
19304 $table[
'border_details'][
'B'][
'w'] /= $k;
19305 $table[
'border_details'][
'L'][
'w'] /= $k;
19307 if (isset($table[
'max_cell_border_width'][
'T'])) {
19308 $table[
'max_cell_border_width'][
'T'] /= $k;
19310 if (isset($table[
'max_cell_border_width'][
'R'])) {
19311 $table[
'max_cell_border_width'][
'R'] /= $k;
19313 if (isset($table[
'max_cell_border_width'][
'B'])) {
19314 $table[
'max_cell_border_width'][
'B'] /= $k;
19316 if (isset($table[
'max_cell_border_width'][
'L'])) {
19317 $table[
'max_cell_border_width'][
'L'] /= $k;
19320 if ($this->simpleTables) {
19321 $table[
'simple'][
'border_details'][
'T'][
'w'] /= $k;
19322 $table[
'simple'][
'border_details'][
'R'][
'w'] /= $k;
19323 $table[
'simple'][
'border_details'][
'B'][
'w'] /= $k;
19324 $table[
'simple'][
'border_details'][
'L'][
'w'] /= $k;
19327 $table[
'miw'] /= $k;
19328 $table[
'maw'] /= $k;
19330 for ($j = 0; $j < $table[
'nc']; $j++) {
19332 $table[
'wc'][$j][
'miw'] = isset($table[
'wc'][$j][
'miw']) ? $table[
'wc'][$j][
'miw'] : 0;
19333 $table[
'wc'][$j][
'maw'] = isset($table[
'wc'][$j][
'maw']) ? $table[
'wc'][$j][
'maw'] : 0;
19335 $table[
'wc'][$j][
'miw'] /= $k;
19336 $table[
'wc'][$j][
'maw'] /= $k;
19338 if (isset($table[
'decimal_align'][$j][
'maxs0']) && $table[
'decimal_align'][$j][
'maxs0']) {
19339 $table[
'decimal_align'][$j][
'maxs0'] /= $k;
19342 if (isset($table[
'decimal_align'][$j][
'maxs1']) && $table[
'decimal_align'][$j][
'maxs1']) {
19343 $table[
'decimal_align'][$j][
'maxs1'] /= $k;
19346 if (isset($table[
'wc'][$j][
'absmiw']) && $table[
'wc'][$j][
'absmiw']) {
19347 $table[
'wc'][$j][
'absmiw'] /= $k;
19350 for ($i = 0; $i < $table[
'nr']; $i++) {
19352 $c = &$table[
'cells'][$i][$j];
19354 if (isset($c) && $c) {
19356 if (!$this->simpleTables) {
19358 if ($this->packTableData) {
19360 $cell = $this->_unpackCellBorder($c[
'borderbin']);
19362 $cell[
'border_details'][
'T'][
'w'] /= $k;
19363 $cell[
'border_details'][
'R'][
'w'] /= $k;
19364 $cell[
'border_details'][
'B'][
'w'] /= $k;
19365 $cell[
'border_details'][
'L'][
'w'] /= $k;
19366 $cell[
'border_details'][
'mbw'][
'TL'] /= $k;
19367 $cell[
'border_details'][
'mbw'][
'TR'] /= $k;
19368 $cell[
'border_details'][
'mbw'][
'BL'] /= $k;
19369 $cell[
'border_details'][
'mbw'][
'BR'] /= $k;
19370 $cell[
'border_details'][
'mbw'][
'LT'] /= $k;
19371 $cell[
'border_details'][
'mbw'][
'LB'] /= $k;
19372 $cell[
'border_details'][
'mbw'][
'RT'] /= $k;
19373 $cell[
'border_details'][
'mbw'][
'RB'] /= $k;
19375 $c[
'borderbin'] = $this->_packCellBorder($cell);
19379 $c[
'border_details'][
'T'][
'w'] /= $k;
19380 $c[
'border_details'][
'R'][
'w'] /= $k;
19381 $c[
'border_details'][
'B'][
'w'] /= $k;
19382 $c[
'border_details'][
'L'][
'w'] /= $k;
19383 $c[
'border_details'][
'mbw'][
'TL'] /= $k;
19384 $c[
'border_details'][
'mbw'][
'TR'] /= $k;
19385 $c[
'border_details'][
'mbw'][
'BL'] /= $k;
19386 $c[
'border_details'][
'mbw'][
'BR'] /= $k;
19387 $c[
'border_details'][
'mbw'][
'LT'] /= $k;
19388 $c[
'border_details'][
'mbw'][
'LB'] /= $k;
19389 $c[
'border_details'][
'mbw'][
'RT'] /= $k;
19390 $c[
'border_details'][
'mbw'][
'RB'] /= $k;
19394 $c[
'padding'][
'T'] /= $k;
19395 $c[
'padding'][
'R'] /= $k;
19396 $c[
'padding'][
'B'] /= $k;
19397 $c[
'padding'][
'L'] /= $k;
19399 $c[
'maxs'] = isset($c[
'maxs']) ? $c[
'maxs'] /= $k :
null;
19400 $c[
'w'] = isset($c[
'w']) ? $c[
'w'] /= $k :
null;
19402 $c[
's'] = isset($c[
's']) ? $c[
's'] /= $k : 0;
19403 $c[
'h'] = isset($c[
'h']) ? $c[
'h'] /= $k :
null;
19405 $c[
'miw'] = isset($c[
'miw']) ? $c[
'miw'] /= $k : 0;
19406 $c[
'maw'] = isset($c[
'maw']) ? $c[
'maw'] /= $k : 0;
19408 $c[
'absmiw'] = isset($c[
'absmiw']) ? $c[
'absmiw'] /= $k :
null;
19410 $c[
'nestedmaw'] = isset($c[
'nestedmaw']) ? $c[
'nestedmaw'] /= $k :
null;
19411 $c[
'nestedmiw'] = isset($c[
'nestedmiw']) ? $c[
'nestedmiw'] /= $k :
null;
19413 if (isset($c[
'textbuffer'])) {
19414 foreach ($c[
'textbuffer'] as $n => $tb) {
19415 if (!empty($tb[16])) {
19416 !isset($c[
'textbuffer'][$n][16][
'T']) || $c[
'textbuffer'][$n][16][
'T'][
'w'] /= $k;
19417 !isset($c[
'textbuffer'][$n][16][
'B']) || $c[
'textbuffer'][$n][16][
'B'][
'w'] /= $k;
19418 !isset($c[
'textbuffer'][$n][16][
'L']) || $c[
'textbuffer'][$n][16][
'L'][
'w'] /= $k;
19419 !isset($c[
'textbuffer'][$n][16][
'R']) || $c[
'textbuffer'][$n][16][
'R'][
'w'] /= $k;
19433 $s = fread($fh, 2);
19434 $a = (ord($s[0]) << 8) + ord($s[1]);
19435 if ($a & (1 << 15)) {
19436 $a = ($a - (1 << 16));
19443 if (!is_array($cell) || !isset($cell)) {
19447 if (!$this->packTableData) {
19451 $bindata = pack(
"nnda6A10nnda6A10nnda6A10nnda6A10nd9", $cell[
'border'], $cell[
'border_details'][
'R'][
's'], $cell[
'border_details'][
'R'][
'w'], $cell[
'border_details'][
'R'][
'c'], $cell[
'border_details'][
'R'][
'style'], $cell[
'border_details'][
'R'][
'dom'], $cell[
'border_details'][
'L'][
's'], $cell[
'border_details'][
'L'][
'w'], $cell[
'border_details'][
'L'][
'c'], $cell[
'border_details'][
'L'][
'style'], $cell[
'border_details'][
'L'][
'dom'], $cell[
'border_details'][
'T'][
's'], $cell[
'border_details'][
'T'][
'w'], $cell[
'border_details'][
'T'][
'c'], $cell[
'border_details'][
'T'][
'style'], $cell[
'border_details'][
'T'][
'dom'], $cell[
'border_details'][
'B'][
's'], $cell[
'border_details'][
'B'][
'w'], $cell[
'border_details'][
'B'][
'c'], $cell[
'border_details'][
'B'][
'style'], $cell[
'border_details'][
'B'][
'dom'], $cell[
'border_details'][
'mbw'][
'BL'], $cell[
'border_details'][
'mbw'][
'BR'], $cell[
'border_details'][
'mbw'][
'RT'], $cell[
'border_details'][
'mbw'][
'RB'], $cell[
'border_details'][
'mbw'][
'TL'], $cell[
'border_details'][
'mbw'][
'TR'], $cell[
'border_details'][
'mbw'][
'LT'], $cell[
'border_details'][
'mbw'][
'LB'], (isset($cell[
'border_details'][
'cellposdom']) ? $cell[
'border_details'][
'cellposdom'] : 0));
19458 return [0, 0, 0, 0];
19460 if (!$this->packTableData) {
19461 return [$bindata[
'border_details'][
'T'][
'w'], $bindata[
'border_details'][
'R'][
'w'], $bindata[
'border_details'][
'B'][
'w'], $bindata[
'border_details'][
'L'][
'w']];
19464 $bd = unpack(
"nbord/nrs/drw/a6rca/A10rst/nrd/nls/dlw/a6lca/A10lst/nld/nts/dtw/a6tca/A10tst/ntd/nbs/dbw/a6bca/A10bst/nbd/dmbl/dmbr/dmrt/dmrb/dmtl/dmtr/dmlt/dmlb/dcpd", $bindata);
19465 $cell[
'border_details'][
'R'][
'w'] = $bd[
'rw'];
19466 $cell[
'border_details'][
'L'][
'w'] = $bd[
'lw'];
19467 $cell[
'border_details'][
'T'][
'w'] = $bd[
'tw'];
19468 $cell[
'border_details'][
'B'][
'w'] = $bd[
'bw'];
19469 return [$bd[
'tw'], $bd[
'rw'], $bd[
'bw'], $bd[
'lw']];
19477 if (!$this->packTableData) {
19481 $bd = unpack(
"nbord/nrs/drw/a6rca/A10rst/nrd/nls/dlw/a6lca/A10lst/nld/nts/dtw/a6tca/A10tst/ntd/nbs/dbw/a6bca/A10bst/nbd/dmbl/dmbr/dmrt/dmrb/dmtl/dmtr/dmlt/dmlb/dcpd", $bindata);
19483 $cell[
'border'] = $bd[
'bord'];
19484 $cell[
'border_details'][
'R'][
's'] = $bd[
'rs'];
19485 $cell[
'border_details'][
'R'][
'w'] = $bd[
'rw'];
19486 $cell[
'border_details'][
'R'][
'c'] = str_pad($bd[
'rca'], 6,
"\x00");
19487 $cell[
'border_details'][
'R'][
'style'] = trim($bd[
'rst']);
19488 $cell[
'border_details'][
'R'][
'dom'] = $bd[
'rd'];
19490 $cell[
'border_details'][
'L'][
's'] = $bd[
'ls'];
19491 $cell[
'border_details'][
'L'][
'w'] = $bd[
'lw'];
19492 $cell[
'border_details'][
'L'][
'c'] = str_pad($bd[
'lca'], 6,
"\x00");
19493 $cell[
'border_details'][
'L'][
'style'] = trim($bd[
'lst']);
19494 $cell[
'border_details'][
'L'][
'dom'] = $bd[
'ld'];
19496 $cell[
'border_details'][
'T'][
's'] = $bd[
'ts'];
19497 $cell[
'border_details'][
'T'][
'w'] = $bd[
'tw'];
19498 $cell[
'border_details'][
'T'][
'c'] = str_pad($bd[
'tca'], 6,
"\x00");
19499 $cell[
'border_details'][
'T'][
'style'] = trim($bd[
'tst']);
19500 $cell[
'border_details'][
'T'][
'dom'] = $bd[
'td'];
19502 $cell[
'border_details'][
'B'][
's'] = $bd[
'bs'];
19503 $cell[
'border_details'][
'B'][
'w'] = $bd[
'bw'];
19504 $cell[
'border_details'][
'B'][
'c'] = str_pad($bd[
'bca'], 6,
"\x00");
19505 $cell[
'border_details'][
'B'][
'style'] = trim($bd[
'bst']);
19506 $cell[
'border_details'][
'B'][
'dom'] = $bd[
'bd'];
19508 $cell[
'border_details'][
'mbw'][
'BL'] = $bd[
'mbl'];
19509 $cell[
'border_details'][
'mbw'][
'BR'] = $bd[
'mbr'];
19510 $cell[
'border_details'][
'mbw'][
'RT'] = $bd[
'mrt'];
19511 $cell[
'border_details'][
'mbw'][
'RB'] = $bd[
'mrb'];
19512 $cell[
'border_details'][
'mbw'][
'TL'] = $bd[
'mtl'];
19513 $cell[
'border_details'][
'mbw'][
'TR'] = $bd[
'mtr'];
19514 $cell[
'border_details'][
'mbw'][
'LT'] = $bd[
'mlt'];
19515 $cell[
'border_details'][
'mbw'][
'LB'] = $bd[
'mlb'];
19516 $cell[
'border_details'][
'cellposdom'] = $bd[
'cpd'];
19535 $cs = &$table[
'cells'];
19537 $nc = $table[
'nc'];
19538 $nr = $table[
'nr'];
19541 if ($table[
'borders_separate']) {
19542 $tblbw = $table[
'border_details'][
'L'][
'w'] + $table[
'border_details'][
'R'][
'w'] + $table[
'margin'][
'L'] + $table[
'margin'][
'R'] + $table[
'padding'][
'L'] + $table[
'padding'][
'R'] + $table[
'border_spacing_H'];
19544 $tblbw = $table[
'max_cell_border_width'][
'L'] / 2 + $table[
'max_cell_border_width'][
'R'] / 2 + $table[
'margin'][
'L'] + $table[
'margin'][
'R'];
19550 for ($j = 0; $j < $nc; $j++) {
19551 $wc = &$table[
'wc'][$j];
19552 for ($i = 0; $i < $nr; $i++) {
19553 if (isset($cs[$i][$j]) && $cs[$i][$j]) {
19556 if ($this->simpleTables) {
19557 if ($table[
'borders_separate']) {
19558 $extrcw = $table[
'simple'][
'border_details'][
'L'][
'w'] + $table[
'simple'][
'border_details'][
'R'][
'w'] + $c[
'padding'][
'L'] + $c[
'padding'][
'R'] + $table[
'border_spacing_H'];
19560 $extrcw = $table[
'simple'][
'border_details'][
'L'][
'w'] / 2 + $table[
'simple'][
'border_details'][
'R'][
'w'] / 2 + $c[
'padding'][
'L'] + $c[
'padding'][
'R'];
19563 if ($this->packTableData) {
19564 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($c[
'borderbin']);
19566 $br = $c[
'border_details'][
'R'][
'w'];
19567 $bl = $c[
'border_details'][
'L'][
'w'];
19569 if ($table[
'borders_separate']) {
19570 $extrcw = $bl + $br + $c[
'padding'][
'L'] + $c[
'padding'][
'R'] + $table[
'border_spacing_H'];
19572 $extrcw = $bl / 2 + $br / 2 + $c[
'padding'][
'L'] + $c[
'padding'][
'R'];
19578 if (substr($c[
'a'], 0, 1) ==
'D') {
19579 $mw = $table[
'decimal_align'][$j][
'maxs0'] + $table[
'decimal_align'][$j][
'maxs1'] + $extrcw;
19582 $c[
'absmiw'] = $mw;
19584 if (isset($c[
'R']) && $c[
'R']) {
19585 $c[
'maw'] = $c[
'miw'] = $this->FontSize + $extrcw;
19586 if (isset($c[
'w'])) {
19587 if ($c[
'miw'] < $c[
'w']) {
19588 $c[
'miw'] = $c[
'w'];
19591 if (!isset($c[
'colspan'])) {
19592 if ($wc[
'miw'] < $c[
'miw']) {
19593 $wc[
'miw'] = $c[
'miw'];
19595 if ($wc[
'maw'] < $c[
'maw']) {
19596 $wc[
'maw'] = $c[
'maw'];
19600 if (isset($table[
'l'][$j])) {
19601 $table[
'l'][$j] += $c[
'miw'];
19603 $table[
'l'][$j] = $c[
'miw'];
19607 if ($c[
'miw'] > $wc[
'miw']) {
19608 $wc[
'miw'] = $c[
'miw'];
19610 if ($wc[
'miw'] > $wc[
'maw']) {
19611 $wc[
'maw'] = $wc[
'miw'];
19617 if (isset($c[
's'])) {
19618 $c[
's'] += $extrcw;
19620 if (isset($c[
'maxs'])) {
19621 $c[
'maxs'] += $extrcw;
19623 if (isset($c[
'nestedmiw'])) {
19624 $c[
'nestedmiw'] += $extrcw;
19626 if (isset($c[
'nestedmaw'])) {
19627 $c[
'nestedmaw'] += $extrcw;
19633 if (isset($c[
'nestedmiw']) && (!isset($this->table[1][1][
'overflow']) || $this->table[1][1][
'overflow'] !=
'visible')) {
19634 $miw = $c[
'nestedmiw'];
19639 if (isset($c[
'maxs']) && $c[
'maxs'] !=
'') {
19640 $c[
's'] = $c[
'maxs'];
19644 if (isset($c[
'nestedmaw'])) {
19645 $c[
'maw'] = $c[
'nestedmaw'];
19647 $c[
'maw'] = $c[
's'];
19650 if (isset($table[
'overflow']) && $table[
'overflow'] ==
'visible' && $table[
'level'] == 1) {
19651 if (($c[
'maw'] + $tblbw) > $this->blk[$this->blklvl][
'inner_width']) {
19652 $c[
'maw'] = $this->blk[$this->blklvl][
'inner_width'] - $tblbw;
19656 if (isset($c[
'nowrap']) && $c[
'nowrap']) {
19660 if (isset($c[
'wpercent']) && $firstpass) {
19661 if (isset($c[
'colspan'])) {
19662 for ($k = 0; $k < $c[
'colspan']; $k++) {
19663 $table[
'wc'][($j + $k)][
'wpercent'] = $c[
'wpercent'] / $c[
'colspan'];
19666 if (isset($table[
'w']) && $table[
'w']) {
19667 $c[
'w'] = $c[
'wpercent'] / 100 * ($table[
'w'] - $tblbw );
19669 $wc[
'wpercent'] = $c[
'wpercent'];
19673 if (isset($table[
'overflow']) && $table[
'overflow'] ==
'visible' && $table[
'level'] == 1) {
19674 if (isset($c[
'w']) && ($c[
'w'] + $tblbw) > $this->blk[$this->blklvl][
'inner_width']) {
19675 $c[
'w'] = $this->blk[$this->blklvl][
'inner_width'] - $tblbw;
19680 if (isset($c[
'w'])) {
19681 if ($miw < $c[
'w']) {
19682 $c[
'miw'] = $c[
'w'];
19684 if ($miw > $c[
'w']) {
19685 $c[
'miw'] = $c[
'w'] = $miw;
19689 if (!isset($c[
'colspan'])) {
19690 if (!isset($wc[
'w'])) {
19695 $c[
'maw'] = $c[
'w'];
19700 if (isset($c[
'miw']) && $c[
'maw'] < $c[
'miw']) {
19701 $c[
'maw'] = $c[
'miw'];
19703 if (!isset($c[
'colspan'])) {
19704 if (isset($c[
'miw']) && $wc[
'miw'] < $c[
'miw']) {
19705 $wc[
'miw'] = $c[
'miw'];
19707 if ($wc[
'maw'] < $c[
'maw']) {
19708 $wc[
'maw'] = $c[
'maw'];
19710 if ((isset($wc[
'absmiw']) && $wc[
'absmiw'] < $c[
'absmiw']) || !isset($wc[
'absmiw'])) {
19711 $wc[
'absmiw'] = $c[
'absmiw'];
19714 if (isset($table[
'l'][$j])) {
19715 $table[
'l'][$j] += $c[
's'];
19717 $table[
'l'][$j] = $c[
's'];
19720 $listspan[] = [$i, $j];
19725 if (isset($c[
'textbuffer'])) {
19726 if (isset($table[
'overflow']) && $table[
'overflow'] ==
'wrap') {
19732 $minwidth = $this->TableCheckMinWidth($wc[
'miw'] - $extrcw, 0, $c[
'textbuffer'], $letter);
19736 if ($minwidth < 0) {
19738 if (!isset($c[
'colspan'])) {
19739 $wc[
'miw'] = max((isset($wc[
'miw']) ? $wc[
'miw'] : 0), ((-$minwidth) + $extrcw));
19741 $c[
'miw'] = max((isset($c[
'miw']) ? $c[
'miw'] : 0), ((-$minwidth) + $extrcw));
19744 if (!isset($c[
'colspan'])) {
19745 if ($wc[
'miw'] > $wc[
'maw']) {
19746 $wc[
'maw'] = $wc[
'miw'];
19754 $wc = &$table[
'wc'];
19755 foreach ($listspan as $span) {
19756 list($i, $j) = $span;
19758 $lc = $j + $c[
'colspan'];
19765 for ($k = $j; $k < $lc; $k++) {
19766 if (isset($table[
'l'][$k])) {
19768 $table[
'l'][$k] += $c[
'miw'] / $c[
'colspan'];
19770 $table[
'l'][$k] += $c[
's'] / $c[
'colspan'];
19774 $table[
'l'][$k] = $c[
'miw'] / $c[
'colspan'];
19776 $table[
'l'][$k] = $c[
's'] / $c[
'colspan'];
19779 $wis += $wc[$k][
'miw'];
19780 $was += $wc[$k][
'maw'];
19781 if (!isset($c[
'w'])) {
19783 $wisa += $wc[$k][
'miw'];
19784 $wasa += $wc[$k][
'maw'];
19787 if ($c[
'miw'] > $wis) {
19789 for ($k = $j; $k < $lc; $k++) {
19790 $wc[$k][
'miw'] = $c[
'miw'] / $c[
'colspan'];
19792 } elseif (!count($list) && $wis != 0) {
19793 $wi = $c[
'miw'] - $wis;
19794 for ($k = $j; $k < $lc; $k++) {
19795 $wc[$k][
'miw'] += ($wc[$k][
'miw'] / $wis) * $wi;
19798 $wi = $c[
'miw'] - $wis;
19801 foreach ($list as $k) {
19802 if (!isset($wc[$k][
'w']) || !$wc[$k][
'w']) {
19803 $wc[$k][
'miw'] += ($wc[$k][
'miw'] / $wisa) * $wi;
19808 if ($c[
'maw'] > $was) {
19810 for ($k = $j; $k < $lc; $k++) {
19811 $wc[$k][
'maw'] = $c[
'maw'] / $c[
'colspan'];
19813 } elseif (!count($list) && $was != 0) {
19814 $wi = $c[
'maw'] - $was;
19815 for ($k = $j; $k < $lc; $k++) {
19816 $wc[$k][
'maw'] += ($wc[$k][
'maw'] / $was) * $wi;
19819 $wi = $c[
'maw'] - $was;
19822 foreach ($list as $k) {
19823 $wc[$k][
'maw'] += $wi / count($list);
19830 $checkminwidth = 0;
19831 $checkmaxwidth = 0;
19834 for ($i = 0; $i < $nc; $i++) {
19835 $checkminwidth += $table[
'wc'][$i][
'miw'];
19836 $checkmaxwidth += $table[
'wc'][$i][
'maw'];
19837 $totallength += isset($table[
'l']) ? $table[
'l'][$i] : 0;
19840 if (!isset($table[
'w']) && $firstpass) {
19843 for ($i = 0; $i < $nc; $i++) {
19844 if (isset($table[
'wc'][$i][
'wpercent']) && $table[
'wc'][$i][
'wpercent']) {
19845 $sumpc += $table[
'wc'][$i][
'wpercent'];
19853 if ($sumpc >= 100 && $notset) {
19854 for ($i = 0; $i < $nc; $i++) {
19855 if ((!isset($table[
'wc'][$i][
'wpercent']) || !$table[
'wc'][$i][
'wpercent']) &&
19856 (!isset($table[
'wc'][$i][
'w']) || !$table[
'wc'][$i][
'w'])) {
19857 $table[
'wc'][$i][
'wpercent'] = 1;
19864 $sumnonpc = (100 - $sumpc);
19865 $sumpc = max($sumpc, 100);
19868 $miwsurplusnonpc = 0;
19872 $mawsurplusnonpc = 0;
19876 for ($i = 0; $i < $nc; $i++) {
19877 if (isset($table[
'wc'][$i][
'wpercent'])) {
19878 $maxcalcmiw = max($maxcalcmiw, ($table[
'wc'][$i][
'miw'] * $sumpc / $table[
'wc'][$i][
'wpercent']));
19879 $maxcalcmaw = max($maxcalcmaw, ($table[
'wc'][$i][
'maw'] * $sumpc / $table[
'wc'][$i][
'wpercent']));
19881 $miwleft += $table[
'wc'][$i][
'miw'];
19882 $mawleft += $table[
'wc'][$i][
'maw'];
19883 if (!isset($table[
'wc'][$i][
'w'])) {
19889 if ($miwleft && $sumnonpc > 0) {
19890 $miwnon = $miwleft * 100 / $sumnonpc;
19892 if ($mawleft && $sumnonpc > 0) {
19893 $mawnon = $mawleft * 100 / $sumnonpc;
19895 if (($miwnon > $checkminwidth || $maxcalcmiw > $checkminwidth) && $this->keep_table_proportions) {
19896 if ($miwnon > $maxcalcmiw) {
19897 $miwsurplusnonpc = round((($miwnon * $sumnonpc / 100) - $miwleft), 3);
19898 $checkminwidth = $miwnon;
19900 $checkminwidth = $maxcalcmiw;
19902 for ($i = 0; $i < $nc; $i++) {
19903 if (isset($table[
'wc'][$i][
'wpercent'])) {
19904 $newmiw = $checkminwidth * $table[
'wc'][$i][
'wpercent'] / 100;
19905 if ($table[
'wc'][$i][
'miw'] < $newmiw) {
19906 $table[
'wc'][$i][
'miw'] = $newmiw;
19908 $table[
'wc'][$i][
'w'] = 1;
19909 } elseif ($miwsurplusnonpc && !$table[
'wc'][$i][
'w']) {
19910 $table[
'wc'][$i][
'miw'] += $miwsurplusnonpc / $miwleftcount;
19914 if (($mawnon > $checkmaxwidth || $maxcalcmaw > $checkmaxwidth)) {
19915 if ($mawnon > $maxcalcmaw) {
19916 $mawsurplusnonpc = round((($mawnon * $sumnonpc / 100) - $mawleft), 3);
19917 $checkmaxwidth = $mawnon;
19919 $checkmaxwidth = $maxcalcmaw;
19921 for ($i = 0; $i < $nc; $i++) {
19922 if (isset($table[
'wc'][$i][
'wpercent'])) {
19923 $newmaw = $checkmaxwidth * $table[
'wc'][$i][
'wpercent'] / 100;
19924 if ($table[
'wc'][$i][
'maw'] < $newmaw) {
19925 $table[
'wc'][$i][
'maw'] = $newmaw;
19927 $table[
'wc'][$i][
'w'] = 1;
19928 } elseif ($mawsurplusnonpc && !$table[
'wc'][$i][
'w']) {
19929 $table[
'wc'][$i][
'maw'] += $mawsurplusnonpc / $mawleftcount;
19931 if ($table[
'wc'][$i][
'maw'] < $table[
'wc'][$i][
'miw']) {
19932 $table[
'wc'][$i][
'maw'] = $table[
'wc'][$i][
'miw'];
19936 if ($checkminwidth > $checkmaxwidth) {
19937 $checkmaxwidth = $checkminwidth;
19942 if (isset($table[
'wpercent']) && $table[
'wpercent']) {
19943 $checkminwidth *= (100 / $table[
'wpercent']);
19944 $checkmaxwidth *= (100 / $table[
'wpercent']);
19948 $checkminwidth += $tblbw;
19949 $checkmaxwidth += $tblbw;
19952 if ((isset($table[
'miw']) && $checkminwidth > $table[
'miw']) || !isset($table[
'miw'])) {
19953 $table[
'miw'] = $checkminwidth;
19955 if ((isset($table[
'maw']) && $checkmaxwidth > $table[
'maw']) || !isset($table[
'maw'])) {
19956 $table[
'maw'] = $checkmaxwidth;
19958 $table[
'tl'] = $totallength;
19961 if ($this->table_rotate) {
19962 $mxw = $this->tbrot_maxw;
19964 $mxw = $this->blk[$this->blklvl][
'inner_width'];
19967 if (!isset($table[
'overflow'])) {
19968 $table[
'overflow'] =
null;
19971 if ($table[
'overflow'] ==
'visible') {
19973 } elseif ($table[
'overflow'] ==
'hidden' && !$this->table_rotate && !$this->ColActive && $checkminwidth > $mxw) {
19974 $table[
'w'] = $table[
'miw'];
19979 if (isset($table[
'w']) && $table[
'w']) {
19981 if ($table[
'w'] >= $checkminwidth && $table[
'w'] <= $mxw) {
19982 $table[
'maw'] = $mxw = $table[
'w'];
19983 } elseif ($table[
'w'] >= $checkminwidth && $table[
'w'] > $mxw && $this->keep_table_proportions) {
19984 $checkminwidth = $table[
'w'];
19985 } elseif ($table[
'w'] < $checkminwidth && $checkminwidth < $mxw && $this->keep_table_proportions) {
19986 $table[
'maw'] = $table[
'w'] = $checkminwidth;
19988 unset($table[
'w']);
19992 $ratio = $checkminwidth / $mxw;
19994 if ($checkminwidth > $mxw) {
19995 return [($ratio + 0.001), $checkminwidth];
20005 $widthcols = &$table[
'wc'];
20006 $numcols = $table[
'nc'];
20009 if ($table[
'borders_separate']) {
20010 $tblbw = $table[
'border_details'][
'L'][
'w'] + $table[
'border_details'][
'R'][
'w'] + $table[
'margin'][
'L'] + $table[
'margin'][
'R'] + $table[
'padding'][
'L'] + $table[
'padding'][
'R'] + $table[
'border_spacing_H'];
20012 $tblbw = $table[
'max_cell_border_width'][
'L'] / 2 + $table[
'max_cell_border_width'][
'R'] / 2 + $table[
'margin'][
'L'] + $table[
'margin'][
'R'];
20015 if ($table[
'level'] > 1 && isset($table[
'w'])) {
20017 if (isset($table[
'wpercent']) && $table[
'wpercent']) {
20018 $table[
'w'] = $temppgwidth = (($table[
'w'] - $tblbw) * $table[
'wpercent'] / 100) + $tblbw;
20020 $temppgwidth = $table[
'w'];
20023 } elseif ($this->table_rotate) {
20025 $temppgwidth = $this->tbrot_maxw;
20028 $enddiv = $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w'];
20030 if ($enddiv / $temppgwidth < 0.05) {
20031 $temppgwidth -= $enddiv;
20036 if (isset($table[
'w']) && $table[
'w'] < $this->blk[$this->blklvl][
'inner_width']) {
20038 $temppgwidth = $table[
'w'];
20039 } elseif ($table[
'overflow'] ==
'visible' && $table[
'level'] == 1) {
20040 $temppgwidth =
null;
20041 } elseif ($table[
'overflow'] ==
'hidden' && !$this->ColActive && isset($table[
'w']) && $table[
'w'] > $this->blk[$this->blklvl][
'inner_width'] && $table[
'w'] == $table) {
20043 $temppgwidth = $table[
'w'];
20045 $temppgwidth = $this->blk[$this->blklvl][
'inner_width'];
20050 $totaltextlength = 0;
20051 $totalatextlength = 0;
20052 $percentages_set = 0;
20054 for ($i = 0; $i < $numcols; $i++) {
20055 if (isset($widthcols[$i][
'wpercent'])) {
20056 $tablewidth += $widthcols[$i][
'maw'];
20057 $percentages_set = 1;
20058 } elseif (isset($widthcols[$i][
'w'])) {
20059 $tablewidth += $widthcols[$i][
'miw'];
20061 $tablewidth += $widthcols[$i][
'maw'];
20063 $totaltextlength += isset($table[
'l']) ? $table[
'l'][$i] : 0;
20066 if (!$totaltextlength) {
20067 $totaltextlength = 1;
20070 $tablewidth += $tblbw;
20072 if ($tablewidth > $temppgwidth) {
20073 $table[
'w'] = $temppgwidth;
20074 } elseif ($tablewidth < $temppgwidth && !isset($table[
'w']) && $percentages_set) {
20075 $table[
'w'] = $table[
'maw'];
20079 if (isset($table[
'w']) && $table[
'w'] > $temppgwidth) {
20080 $table[
'w'] = $temppgwidth;
20086 if (isset($table[
'w']) && ($table[
'w'] == $tablewidth) && !$percentages_set) {
20089 for ($i = 0; $i < $numcols; $i++) {
20090 $widthcols[$i] = $widthcols[$i][
'maw'];
20093 } elseif (isset($table[
'w'])) {
20099 for ($i = 0; $i < $numcols; $i++) {
20100 $wis += $widthcols[$i][
'miw'];
20101 if (!isset($widthcols[$i][
'w']) || ($widthcols[$i][
'w'] && $table[
'w'] > $temppgwidth && !$this->keep_table_proportions && !$notfullwidth )) {
20103 $wisa += $widthcols[$i][
'miw'];
20104 $totalatextlength += $table[
'l'][$i];
20108 if (!$totalatextlength) {
20109 $totalatextlength = 1;
20114 if ($table[
'w'] > $wis + $tblbw) {
20117 if ($table[
'w'] < $temppgwidth || $this->keep_table_proportions) {
20118 for ($k = 0; $k < $numcols; $k++) {
20119 if (isset($widthcols[$k][
'wpercent'])) {
20120 $curr = $widthcols[$k][
'miw'];
20121 $widthcols[$k][
'miw'] = ($table[
'w'] - $tblbw) * $widthcols[$k][
'wpercent'] / 100;
20122 $wis += $widthcols[$k][
'miw'] - $curr;
20123 $wisa += $widthcols[$k][
'miw'] - $curr;
20132 if (!count($list)) {
20134 $wi = ($table[
'w'] - ($wis + $tblbw));
20136 for ($k = 0; $k < $numcols; $k++) {
20138 $spareratio = ($table[
'l'][$k] / $totaltextlength);
20141 if ($widthcols[$k][
'miw'] + ($wi * $spareratio) >= $widthcols[$k][
'maw']) {
20142 $surplus += ($wi * $spareratio) - ($widthcols[$k][
'maw'] - $widthcols[$k][
'miw']);
20143 $widthcols[$k][
'miw'] = $widthcols[$k][
'maw'];
20145 $notsetlist[] = $k;
20146 $ttl += $table[
'l'][$k];
20147 $widthcols[$k][
'miw'] += ($wi * $spareratio);
20153 $wi = ($table[
'w'] - ($wis + $tblbw));
20155 foreach ($list as $k) {
20157 $spareratio = ($table[
'l'][$k] / $totalatextlength);
20160 if ($widthcols[$k][
'miw'] + ($wi * $spareratio) >= $widthcols[$k][
'maw']) {
20161 $surplus += ($wi * $spareratio) - ($widthcols[$k][
'maw'] - $widthcols[$k][
'miw']);
20162 $widthcols[$k][
'miw'] = $widthcols[$k][
'maw'];
20164 $notsetlist[] = $k;
20165 $ttl += $table[
'l'][$k];
20166 $widthcols[$k][
'miw'] += ($wi * $spareratio);
20174 if (count($notsetlist) && count($notsetlist) < $numcols) {
20175 foreach ($notsetlist as $i) {
20177 $widthcols[$i][
'miw'] += $surplus * $table[
'l'][$i] / $ttl;
20180 } elseif (count($list) && count($list) < $numcols) {
20181 foreach ($list as $i) {
20182 $widthcols[$i][
'miw'] += $surplus / count($list);
20184 } elseif ($numcols) {
20185 $ttl = array_sum($table[
'l']);
20187 for ($i = 0; $i < $numcols; $i++) {
20188 $widthcols[$i][
'miw'] += $surplus * $table[
'l'][$i] / $ttl;
20196 for ($i = 0; $i < $numcols; $i++) {
20197 $widthcols[$i] = $widthcols[$i][
'miw'];
20202 $checktablewidth = 0;
20203 for ($i = 0; $i < $numcols; $i++) {
20204 $checktablewidth += $widthcols[$i];
20207 if ($checktablewidth > ($temppgwidth + 0.001 - $tblbw)) {
20212 for ($i = 0; $i < $numcols; $i++) {
20213 if ((isset($widthcols[$i]) && $widthcols[$i] > (($temppgwidth - $tblbw) / $numcols)) && (!isset($widthcols[$i][
'w']))) {
20215 unset($widthcols[$i]);
20217 $usedup += $widthcols[$i];
20221 for ($i = 0; $i < $numcols; $i++) {
20222 if (!isset($widthcols[$i]) || !$widthcols[$i]) {
20223 $widthcols[$i] = ((($temppgwidth - $tblbw) - $usedup) / ($numleft));
20230 $table[
'w'] = $tablewidth;
20232 for ($i = 0; $i < $numcols; $i++) {
20234 if (isset($widthcols[$i][
'wpercent']) && $this->keep_table_proportions) {
20235 $colwidth = $widthcols[$i][
'maw'];
20236 } elseif (isset($widthcols[$i][
'w'])) {
20237 $colwidth = $widthcols[$i][
'miw'];
20239 $colwidth = $widthcols[$i][
'maw'];
20242 unset($widthcols[$i]);
20243 $widthcols[$i] = $colwidth;
20248 if ($table[
'overflow'] ===
'visible' && $table[
'level'] == 1) {
20250 if ($tablewidth > $this->blk[$this->blklvl][
'inner_width']) {
20252 for ($j = 0; $j < $numcols; $j++) {
20254 for ($i = 0; $i < $table[
'nr']; $i++) {
20256 if (isset($table[
'cells'][$i][$j]) && $table[
'cells'][$i][$j]) {
20258 $colspan = (isset($table[
'cells'][$i][$j][
'colspan']) ? $table[
'cells'][$i][$j][
'colspan'] : 1);
20260 if ($colspan > 1) {
20263 for ($c = $j; $c < ($j + $colspan); $c++) {
20264 $w += $widthcols[$c];
20267 if ($w > $this->blk[$this->blklvl][
'inner_width']) {
20268 $diff = $w - ($this->blk[$this->blklvl][
'inner_width'] - $tblbw);
20269 for ($c = $j; $c < ($j + $colspan); $c++) {
20270 $widthcols[$c] -= $diff * ($widthcols[$c] / $w);
20272 $table[
'w'] -= $diff;
20273 $table[
'csp'][$j] = $w - $diff;
20284 for ($i = 0; $i < $numcols; $i++) {
20286 if (isset($table[
'csp'][$i])) {
20287 $w = $table[
'csp'][$i];
20288 unset($table[
'csp'][$i]);
20290 $w = $widthcols[$i];
20293 if (($currWc + $w + $tblbw) > $this->blk[$this->blklvl][
'inner_width']) {
20295 $currWc = $widthcols[$i];
20297 $currWc += $widthcols[$i];
20300 $table[
'colPg'][$i] = $pgNo;
20307 $level = $table[
'level'];
20308 $levelid = $table[
'levelid'];
20309 $cells = &$table[
'cells'];
20310 $numcols = $table[
'nc'];
20311 $numrows = $table[
'nr'];
20313 $checkmaxheight = 0;
20314 $headerrowheight = 0;
20315 $checkmaxheightplus = 0;
20316 $headerrowheightplus = 0;
20317 $firstrowheight = 0;
20319 $footerrowheight = 0;
20320 $footerrowheightplus = 0;
20321 if ($this->table_rotate) {
20322 $temppgheight = $this->tbrot_maxh;
20323 $remainingpage = $this->tbrot_maxh;
20325 $temppgheight = ($this->h - $this->bMargin - $this->tMargin) - $this->kwt_height;
20326 $remainingpage = ($this->h - $this->bMargin - $this->y) - $this->kwt_height;
20330 $enddiv = $this->blk[$this->blklvl][
'padding_bottom'] + $this->blk[$this->blklvl][
'border_bottom'][
'w'] + $table[
'margin'][
'B'];
20331 if ($remainingpage > $enddiv && $enddiv / $remainingpage < 0.05) {
20332 $remainingpage -= $enddiv;
20333 } elseif ($remainingpage == 0) {
20334 $remainingpage = 0.001;
20336 if ($temppgheight > $enddiv && $enddiv / $temppgheight < 0.05) {
20337 $temppgheight -= $enddiv;
20338 } elseif ($temppgheight == 0) {
20339 $temppgheight = 0.001;
20342 if ($remainingpage < 0) {
20343 $remainingpage = 0.001;
20345 if ($temppgheight < 0) {
20346 $temppgheight = 0.001;
20349 for ($i = 0; $i < $numrows; $i++) {
20350 $heightrow = &$table[
'hr'][$i];
20351 for ($j = 0; $j < $numcols; $j++) {
20352 if (isset($cells[$i][$j]) && $cells[$i][$j]) {
20353 $c = &$cells[$i][$j];
20355 if ($this->simpleTables) {
20356 if ($table[
'borders_separate']) {
20357 $extraWLR = ($table[
'simple'][
'border_details'][
'L'][
'w'] + $table[
'simple'][
'border_details'][
'R'][
'w']) + ($c[
'padding'][
'L'] + $c[
'padding'][
'R']) + $table[
'border_spacing_H'];
20358 $extrh = ($table[
'simple'][
'border_details'][
'T'][
'w'] + $table[
'simple'][
'border_details'][
'B'][
'w']) + ($c[
'padding'][
'T'] + $c[
'padding'][
'B']) + $table[
'border_spacing_V'];
20360 $extraWLR = ($table[
'simple'][
'border_details'][
'L'][
'w'] + $table[
'simple'][
'border_details'][
'R'][
'w']) / 2 + ($c[
'padding'][
'L'] + $c[
'padding'][
'R']);
20361 $extrh = ($table[
'simple'][
'border_details'][
'T'][
'w'] + $table[
'simple'][
'border_details'][
'B'][
'w']) / 2 + ($c[
'padding'][
'T'] + $c[
'padding'][
'B']);
20364 if ($this->packTableData) {
20365 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($c[
'borderbin']);
20367 $bt = $c[
'border_details'][
'T'][
'w'];
20368 $bb = $c[
'border_details'][
'B'][
'w'];
20369 $br = $c[
'border_details'][
'R'][
'w'];
20370 $bl = $c[
'border_details'][
'L'][
'w'];
20372 if ($table[
'borders_separate']) {
20373 $extraWLR = $bl + $br + $c[
'padding'][
'L'] + $c[
'padding'][
'R'] + $table[
'border_spacing_H'];
20374 $extrh = $bt + $bb + $c[
'padding'][
'T'] + $c[
'padding'][
'B'] + $table[
'border_spacing_V'];
20376 $extraWLR = $bl / 2 + $br / 2 + $c[
'padding'][
'L'] + $c[
'padding'][
'R'];
20377 $extrh = $bt / 2 + $bb / 2 + $c[
'padding'][
'T'] + $c[
'padding'][
'B'];
20381 if ($table[
'overflow'] ==
'visible' && $level == 1) {
20382 list($x,
$cw) = $this->_splitTableGetWidth($table, $i, $j);
20384 list($x,
$cw) = $this->_tableGetWidth($table, $i, $j);
20390 if ($c[
'R'] && isset($c[
'textbuffer'])) {
20392 foreach ($c[
'textbuffer'] as $t) {
20393 $str .= $t[0] .
' ';
20395 $str = rtrim($str);
20396 $s_fs = $this->FontSizePt;
20397 $s_f = $this->FontFamily;
20398 $s_st = $this->FontStyle;
20399 $this->
SetFont($c[
'textbuffer'][0][4], $c[
'textbuffer'][0][2], $c[
'textbuffer'][0][11] / $this->shrin_k,
true,
true);
20400 $tempch = $this->GetStringWidth($str,
true, $c[
'textbuffer'][0][18], $c[
'textbuffer'][0][8]);
20401 if ($c[
'R'] >= 45 && $c[
'R'] < 90) {
20402 $tempch = ((sin(deg2rad($c[
'R']))) * $tempch ) + ((sin(deg2rad($c[
'R']))) * (($c[
'textbuffer'][0][11] / Mpdf::SCALE) / $this->shrin_k));
20404 $this->
SetFont($s_f, $s_st, $s_fs,
true,
true);
20405 $ch = ($tempch ) + $extrh;
20407 if (isset($c[
'textbuffer']) && !empty($c[
'textbuffer'])) {
20408 $this->cellLineHeight = $c[
'cellLineHeight'];
20409 $this->cellLineStackingStrategy = $c[
'cellLineStackingStrategy'];
20410 $this->cellLineStackingShift = $c[
'cellLineStackingShift'];
20411 $this->divwidth =
$cw - $extraWLR;
20412 $tempch = $this->printbuffer($c[
'textbuffer'],
'',
true,
true);
20418 $ch = $tempch + $extrh;
20421 if (isset($c[
'h']) && $c[
'h'] > $ch) {
20427 if (isset($c[
'rowspan'])) {
20428 $listspan[] = [$i, $j];
20429 } elseif ($heightrow < $ch) {
20434 if ($table[
'borders_separate']) {
20435 if ($i == ($numrows - 1) || (isset($c[
'rowspan']) && ($i + $c[
'rowspan']) == ($numrows))) {
20436 $extra = $table[
'margin'][
'B'] + $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] / 2;
20438 $extra = $table[
'border_spacing_V'] / 2;
20441 if (!$this->simpleTables) {
20443 } elseif ($this->simpleTables) {
20444 $extra = $table[
'simple'][
'border_details'][
'B'][
'w'] / 2;
20447 if (isset($table[
'is_thead'][$i]) && $table[
'is_thead'][$i]) {
20449 $headerrowheight += $ch;
20450 $headerrowheightplus += $ch + $extra;
20452 } elseif (isset($table[
'is_tfoot'][$i]) && $table[
'is_tfoot'][$i]) {
20454 $footerrowheight += $ch;
20455 $footerrowheightplus += $ch + $extra;
20458 $checkmaxheight = max($checkmaxheight, $ch);
20459 $checkmaxheightplus = max($checkmaxheightplus, $ch + $extra);
20461 if ($this->tableLevel == 1 && $i == (isset($table[
'headernrows']) ? $table[
'headernrows'] : 0)) {
20462 $firstrowheight = max($ch, $firstrowheight);
20469 $heightrow = &$table[
'hr'];
20470 foreach ($listspan as $span) {
20471 list($i, $j) = $span;
20472 $c = &$cells[$i][$j];
20473 $lr = $i + $c[
'rowspan'];
20474 if ($lr > $numrows) {
20479 for ($k = $i; $k < $lr; $k++) {
20480 $hs += $heightrow[$k];
20483 for ($m = 0; $m < $numcols; $m++) {
20484 $tc = &$cells[$k][$m];
20485 if (isset($tc[
'rowspan'])) {
20488 if (isset($tc[
'h'])) {
20498 if ($table[
'borders_separate']) {
20499 if ($i == ($numrows - 1) || ($i + $c[
'rowspan']) == ($numrows)) {
20500 $extra = $table[
'margin'][
'B'] + $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] / 2;
20502 $extra = $table[
'border_spacing_V'] / 2;
20505 if (!$this->simpleTables) {
20506 if ($this->packTableData) {
20507 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($c[
'borderbin']);
20509 $bb = $c[
'border_details'][
'B'][
'w'];
20512 } elseif ($this->simpleTables) {
20513 $extra = $table[
'simple'][
'border_details'][
'B'][
'w'] / 2;
20516 if (!empty($table[
'is_thead'][$i])) {
20517 $headerrowheight = max($headerrowheight, $hs);
20518 $headerrowheightplus = max($headerrowheightplus, $hs + $extra);
20519 } elseif (!empty($table[
'is_tfoot'][$i])) {
20520 $footerrowheight = max($footerrowheight, $hs);
20521 $footerrowheightplus = max($footerrowheightplus, $hs + $extra);
20523 $checkmaxheight = max($checkmaxheight, $hs);
20524 $checkmaxheightplus = max($checkmaxheightplus, $hs + $extra);
20526 if ($this->tableLevel == 1 && $i == (isset($table[
'headernrows']) ? $table[
'headernrows'] : 0)) {
20527 $firstrowheight = max($hs, $firstrowheight);
20530 if ($c[
'mih'] > $hs) {
20532 for ($k = $i; $k < $lr; $k++) {
20533 $heightrow[$k] = $c[
'mih'] / $c[
'rowspan'];
20535 } elseif (!count($list)) {
20536 $hi = $c[
'mih'] - $hs;
20537 for ($k = $i; $k < $lr; $k++) {
20538 $heightrow[$k] += ($heightrow[$k] / $hs) * $hi;
20541 $hi = $c[
'mih'] - $hs;
20542 foreach ($list as $k) {
20543 $heightrow[$k] += $hi / (count($list));
20552 if ($heightrow[$i] == 0) {
20555 foreach ($listspan as $checkspan) {
20556 list($cki, $ckj) = $checkspan;
20557 $c = &$cells[$cki][$ckj];
20558 if (isset($c[
'rowspan']) && $c[
'rowspan'] > 1) {
20559 if (($cki + $c[
'rowspan'] - 1) >= $i) {
20560 $top = min($top, $cki);
20564 $bottom = $i + $c[
'rowspan'] - 1;
20566 for ($k = $top; $k <= $bottom; $k++) {
20568 if ($k != $i && $heightrow[$k] == 0) {
20574 for ($m = 0; $m < $numcols; $m++) {
20575 if (!isset($cells[$k][$m]) || $cells[$k][$m] == 0) {
20579 } elseif ($k == $bottom) {
20581 for ($m = 0; $m < $numcols; $m++) {
20582 $c = &$cells[$k][$m];
20583 if (isset($c[
'rowspan']) && $c[
'rowspan'] > 1) {
20594 for ($m = 0; $m < $numcols; $m++) {
20595 for ($k = $top; $k <= $bottom; $k++) {
20596 if (isset($cells[$k][$m]) && $cells[$k][$m] != 0) {
20597 $c = &$cells[$k][$m];
20598 if (isset($c[
'h']) && $c[
'h']) {
20604 if (isset($colH[$m])) {
20605 $colH[$m] += $useh;
20609 if (!isset($c[
'rowspan']) || $c[
'rowspan'] < 2) {
20610 $newhr[$k] = max((isset($newhr[$k]) ? $newhr[$k] : 0), $useh);
20614 $extH = max($extH, $colH[$m]);
20616 $newhr[$i] = $extH - array_sum($newhr);
20617 for ($k = $top; $k <= $bottom; $k++) {
20618 $heightrow[$k] = $newhr[$k];
20626 $table[
'h'] = array_sum($heightrow);
20629 if ($table[
'borders_separate']) {
20630 $table[
'h'] += $table[
'margin'][
'T'] + $table[
'margin'][
'B'] + $table[
'border_details'][
'T'][
'w'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] + $table[
'padding'][
'T'] + $table[
'padding'][
'B'];
20632 $table[
'h'] += $table[
'margin'][
'T'] + $table[
'margin'][
'B'] + $table[
'max_cell_border_width'][
'T'] / 2 + $table[
'max_cell_border_width'][
'B'] / 2;
20635 $maxrowheight = $checkmaxheightplus + $headerrowheightplus + $footerrowheightplus;
20636 $maxfirstrowheight = $firstrowheight + $headerrowheightplus + $footerrowheightplus;
20637 return [$table[
'h'], $maxrowheight, $temppgheight, $remainingpage, $maxfirstrowheight];
20642 $cell = &$table[
'cells'][$i][$j];
20644 if (isset($cell[
'x0'])) {
20645 return [$cell[
'x0'], $cell[
'w0']];
20648 $widthcols = &$table[
'wc'];
20649 for ($k = 0; $k < $j; $k++) {
20650 $x += $widthcols[$k];
20652 $w = $widthcols[$j];
20653 if (isset($cell[
'colspan'])) {
20654 for ($k = $j + $cell[
'colspan'] - 1; $k > $j; $k--) {
20655 $w += $widthcols[$k];
20667 $cell = &$table[
'cells'][$i][$j];
20669 if (isset($cell[
'x0'])) {
20670 return [$cell[
'x0'], $cell[
'w0']];
20673 $widthcols = &$table[
'wc'];
20674 $pg = $table[
'colPg'][$j];
20675 for ($k = 0; $k < $j; $k++) {
20676 if ($table[
'colPg'][$k] == $pg) {
20677 $x += $widthcols[$k];
20680 $w = $widthcols[$j];
20681 if (isset($cell[
'colspan'])) {
20682 for ($k = $j + $cell[
'colspan'] - 1; $k > $j; $k--) {
20683 if ($table[
'colPg'][$k] == $pg) {
20684 $w += $widthcols[$k];
20697 $cell = &$table[
'cells'][$i][$j];
20699 if (isset($cell[
'y0'])) {
20700 return [$cell[
'y0'], $cell[
'h0']];
20703 $heightrow = &$table[
'hr'];
20704 for ($k = 0; $k < $i; $k++) {
20705 $y += $heightrow[$k];
20707 $h = $heightrow[$i];
20708 if (isset($cell[
'rowspan'])) {
20709 for ($k = $i + $cell[
'rowspan'] - 1; $k > $i; $k--) {
20710 if (array_key_exists($k, $heightrow)) {
20711 $h += $heightrow[$k];
20713 $this->logger->debug(
'Possible non-wellformed HTML markup in a table', [
'context' => LogContext::HTML_MARKUP]);
20726 if ($row == $table[
'nc'] - 1) {
20727 return $table[
'hr'][$row];
20729 $maxrowheight = $table[
'hr'][$row];
20730 for ($i = $row + 1; $i < $table[
'nr']; $i++) {
20732 for ($j = 0; $j < $table[
'nc']; $j++) {
20733 if ($table[
'cells'][$i][$j]) {
20734 if (isset($table[
'cells'][$i][$j][
'colspan'])) {
20735 $cellsset += $table[
'cells'][$i][$j][
'colspan'];
20741 if ($cellsset == $table[
'nc']) {
20742 return $maxrowheight;
20744 $maxrowheight += $table[
'hr'][$i];
20747 return $maxrowheight;
20751 function _tableRect($x, $y, $w, $h, $bord = -1, $details = [], $buffer =
false, $bSeparate =
false, $cort =
'cell', $tablecorner =
'', $bsv = 0, $bsh = 0)
20753 $cellBorderOverlay = [];
20756 $this->Rect($x, $y, $w, $h);
20757 } elseif ($this->simpleTables && ($cort ==
'cell')) {
20759 if ($details[
'L'][
'c']) {
20760 $this->SetDColor($details[
'L'][
'c']);
20762 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
20764 $this->SetLineJoin(0);
20765 $this->Rect($x, $y, $w, $h);
20767 if (!$bSeparate && $buffer) {
20768 $priority =
'LRTB';
20769 for ($p = 0; $p < strlen($priority); $p++) {
20770 $side = $priority[$p];
20771 $details[
'p'] = $side;
20774 if (isset($details[$side][
'w'])) {
20775 $dom += ($details[$side][
'w'] * 100000);
20777 if (isset($details[$side][
'style'])) {
20778 $dom += (array_search($details[$side][
'style'], $this->borderstyles) * 100);
20780 if (isset($details[$side][
'dom'])) {
20781 $dom += ($details[$side][
'dom'] * 10);
20786 if (isset($details[$side][
'c']) && is_array($details[$side][
'c'])) {
20787 if ($details[$side][
'c'][0] == 3) {
20788 $coldom = 10 - (((ord($details[$side][
'c'][1]) * 1.00) + (ord($details[$side][
'c'][2]) * 1.00) + (ord($details[$side][
'c'][3]) * 1.00)) / 76.5);
20795 if (isset($details[
'cellposdom'])) {
20796 $dom += $details[
'cellposdom'];
20800 if ($side ==
'T' && $this->issetBorder($bord,
Border::TOP)) {
20803 } elseif ($side ==
'L' && $this->issetBorder($bord,
Border::LEFT)) {
20806 } elseif ($side ==
'R' && $this->issetBorder($bord,
Border::RIGHT)) {
20809 } elseif ($side ==
'B' && $this->issetBorder($bord,
Border::BOTTOM)) {
20815 $this->cellBorderBuffer[] = pack(
"A16nCnda6A10d14", str_pad(sprintf(
"%08.7f", $dom), 16,
"0", STR_PAD_LEFT), $cbord, ord($side), $details[$side][
's'], $details[$side][
'w'], $details[$side][
'c'], $details[$side][
'style'], $x, $y, $w, $h, $details[
'mbw'][
'BL'], $details[
'mbw'][
'BR'], $details[
'mbw'][
'RT'], $details[
'mbw'][
'RB'], $details[
'mbw'][
'TL'], $details[
'mbw'][
'TR'], $details[
'mbw'][
'LT'], $details[
'mbw'][
'LB'], $details[
'cellposdom'], 0);
20816 if ($details[$side][
'style'] ==
'ridge' || $details[$side][
'style'] ==
'groove' || $details[$side][
'style'] ==
'inset' || $details[$side][
'style'] ==
'outset' || $details[$side][
'style'] ==
'double') {
20817 $details[$side][
'overlay'] =
true;
20818 $this->cellBorderBuffer[] = pack(
"A16nCnda6A10d14", str_pad(sprintf(
"%08.7f", ($dom + 4)), 16,
"0", STR_PAD_LEFT), $cbord, ord($side), $details[$side][
's'], $details[$side][
'w'], $details[$side][
'c'], $details[$side][
'style'], $x, $y, $w, $h, $details[
'mbw'][
'BL'], $details[
'mbw'][
'BR'], $details[
'mbw'][
'RT'], $details[
'mbw'][
'RB'], $details[
'mbw'][
'TL'], $details[
'mbw'][
'TR'], $details[
'mbw'][
'LT'], $details[
'mbw'][
'LB'], $details[
'cellposdom'], 1);
20825 if (isset($details[
'p']) && strlen($details[
'p']) > 1) {
20826 $priority = $details[
'p'];
20828 $priority =
'LTRB';
20834 if (isset($details[
'T'][
'w'])) {
20835 $Tw = $details[
'T'][
'w'];
20837 if (isset($details[
'R'][
'w'])) {
20838 $Rw = $details[
'R'][
'w'];
20840 if (isset($details[
'B'][
'w'])) {
20841 $Bw = $details[
'B'][
'w'];
20843 if (isset($details[
'L'][
'w'])) {
20844 $Lw = $details[
'L'][
'w'];
20849 $oldlinewidth = $this->LineWidth;
20851 for ($p = 0; $p < strlen($priority); $p++) {
20852 $side = $priority[$p];
20858 if ($Tw && $side ==
'T' && $this->issetBorder($bord,
Border::TOP)) {
20864 if ($cort ==
'cell' || strpos($tablecorner,
'L') !==
false) {
20866 $xadj = ($Tw - $Lw) / 2;
20869 $xadj = ($Tw + $Lw) / 2;
20872 $xadj = $Tw / 2 - $bsh / 2;
20874 if ($cort ==
'cell' || strpos($tablecorner,
'R') !==
false) {
20876 $xadj2 = ($Tw - $Rw) / 2;
20879 $xadj2 = ($Tw + $Rw) / 2;
20882 $xadj2 = $Tw / 2 - $bsh / 2;
20884 if (!$bSeparate && !empty($details[
'mbw']) && !empty($details[
'mbw'][
'TL'])) {
20885 $xadj = ($Tw - $details[
'mbw'][
'TL']) / 2;
20887 if (!$bSeparate && !empty($details[
'mbw']) && !empty($details[
'mbw'][
'TR'])) {
20888 $xadj2 = ($Tw - $details[
'mbw'][
'TR']) / 2;
20892 if ($Lw && $side ==
'L' && $this->issetBorder($bord,
Border::LEFT)) {
20898 if ($cort ==
'cell' || strpos($tablecorner,
'T') !==
false) {
20900 $yadj = ($Lw - $Tw) / 2;
20903 $yadj = ($Lw + $Tw) / 2;
20906 $yadj = $Lw / 2 - $bsv / 2;
20908 if ($cort ==
'cell' || strpos($tablecorner,
'B') !==
false) {
20910 $yadj2 = ($Lw - $Bw) / 2;
20913 $yadj2 = ($Lw + $Bw) / 2;
20916 $yadj2 = $Lw / 2 - $bsv / 2;
20918 if (!$bSeparate && $details[
'mbw'][
'LT']) {
20919 $yadj = ($Lw - $details[
'mbw'][
'LT']) / 2;
20921 if (!$bSeparate && $details[
'mbw'][
'LB']) {
20922 $yadj2 = ($Lw - $details[
'mbw'][
'LB']) / 2;
20926 if ($Rw && $side ==
'R' && $this->issetBorder($bord,
Border::RIGHT)) {
20932 if ($cort ==
'cell' || strpos($tablecorner,
'T') !==
false) {
20934 $yadj = ($Rw + $Tw) / 2;
20937 $yadj = ($Rw - $Tw) / 2;
20940 $yadj = $Rw / 2 - $bsv / 2;
20943 if ($cort ==
'cell' || strpos($tablecorner,
'B') !==
false) {
20945 $yadj2 = ($Rw - $Bw) / 2;
20948 $yadj2 = ($Rw + $Bw) / 2;
20951 $yadj2 = $Rw / 2 - $bsv / 2;
20954 if (!$bSeparate && !empty($details[
'mbw']) && !empty($details[
'mbw'][
'RT'])) {
20955 $yadj = ($Rw - $details[
'mbw'][
'RT']) / 2;
20957 if (!$bSeparate && !empty($details[
'mbw']) && !empty($details[
'mbw'][
'RB'])) {
20958 $yadj2 = ($Rw - $details[
'mbw'][
'RB']) / 2;
20962 if ($Bw && $side ==
'B' && $this->issetBorder($bord,
Border::BOTTOM)) {
20968 if ($cort ==
'cell' || strpos($tablecorner,
'L') !==
false) {
20970 $xadj = ($Bw - $Lw) / 2;
20973 $xadj = ($Bw + $Lw) / 2;
20976 $xadj = $Bw / 2 - $bsh / 2;
20978 if ($cort ==
'cell' || strpos($tablecorner,
'R') !==
false) {
20980 $xadj2 = ($Bw - $Rw) / 2;
20983 $xadj2 = ($Bw + $Rw) / 2;
20986 $xadj2 = $Bw / 2 - $bsh / 2;
20988 if (!$bSeparate && isset($details[
'mbw']) && isset($details[
'mbw'][
'BL'])) {
20989 $xadj = ($Bw - $details[
'mbw'][
'BL']) / 2;
20991 if (!$bSeparate && isset($details[
'mbw']) && isset($details[
'mbw'][
'BR'])) {
20992 $xadj2 = ($Bw - $details[
'mbw'][
'BR']) / 2;
21000 if ($details[$side][
'style'] ==
'double') {
21001 if (!isset($details[$side][
'overlay']) || !$details[$side][
'overlay'] || $bSeparate) {
21002 if ($details[$side][
'c']) {
21003 $this->SetDColor($details[$side][
'c']);
21005 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
21007 $this->Line($lx1 + $xadj, $ly1 + $yadj, $lx2 - $xadj2, $ly2 - $yadj2);
21009 if ((isset($details[$side][
'overlay']) && $details[$side][
'overlay']) || $bSeparate) {
21010 if ($bSeparate && $cort ==
'table') {
21011 if ($side ==
'T') {
21012 $xadj -= $this->LineWidth / 2;
21013 $xadj2 -= $this->LineWidth;
21015 $xadj += $this->LineWidth / 2;
21018 $xadj2 += $this->LineWidth;
21021 if ($side ==
'L') {
21022 $yadj -= $this->LineWidth / 2;
21023 $yadj2 -= $this->LineWidth;
21025 $yadj += $this->LineWidth / 2;
21028 $yadj2 += $this->LineWidth;
21031 if ($side ==
'B') {
21032 $xadj -= $this->LineWidth / 2;
21033 $xadj2 -= $this->LineWidth;
21035 $xadj += $this->LineWidth / 2;
21038 $xadj2 += $this->LineWidth;
21041 if ($side ==
'R') {
21042 $yadj -= $this->LineWidth / 2;
21043 $yadj2 -= $this->LineWidth;
21045 $yadj += $this->LineWidth / 2;
21048 $yadj2 += $this->LineWidth;
21055 $tbcol = $this->colorConverter->convert(255, $this->PDFAXwarnings);
21056 for ($l = 0; $l <= $this->blklvl; $l++) {
21057 if ($this->blk[$l][
'bgcolor']) {
21058 $tbcol = ($this->blk[$l][
'bgcolorarray']);
21063 $cellBorderOverlay[] = [
21064 'x' => $lx1 + $xadj,
21065 'y' => $ly1 + $yadj,
21066 'x2' => $lx2 - $xadj2,
21067 'y2' => $ly2 - $yadj2,
21069 'lw' => $this->LineWidth,
21072 $this->SetDColor($tbcol);
21073 $this->Line($lx1 + $xadj, $ly1 + $yadj, $lx2 - $xadj2, $ly2 - $yadj2);
21076 } elseif (isset($details[$side][
'style']) && ($details[$side][
'style'] ==
'ridge' || $details[$side][
'style'] ==
'groove' || $details[$side][
'style'] ==
'inset' || $details[$side][
'style'] ==
'outset')) {
21077 if (!isset($details[$side][
'overlay']) || !$details[$side][
'overlay'] || $bSeparate) {
21078 if ($details[$side][
'c']) {
21079 $this->SetDColor($details[$side][
'c']);
21081 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
21083 if ($details[$side][
'style'] ==
'outset' || $details[$side][
'style'] ==
'groove') {
21084 $nc = $this->colorConverter->darken($details[$side][
'c']);
21085 $this->SetDColor($nc);
21086 } elseif ($details[$side][
'style'] ==
'ridge' || $details[$side][
'style'] ==
'inset') {
21087 $nc = $this->colorConverter->lighten($details[$side][
'c']);
21088 $this->SetDColor($nc);
21090 $this->Line($lx1 + $xadj, $ly1 + $yadj, $lx2 - $xadj2, $ly2 - $yadj2);
21092 if ((isset($details[$side][
'overlay']) && $details[$side][
'overlay']) || $bSeparate) {
21093 if ($details[$side][
'c']) {
21094 $this->SetDColor($details[$side][
'c']);
21096 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
21098 $doubleadj = ($this->LineWidth) / 3;
21100 $xadj3 = $yadj3 = $wadj3 = $hadj3 = 0;
21102 if ($details[$side][
'style'] ==
'ridge' || $details[$side][
'style'] ==
'inset') {
21103 $nc = $this->colorConverter->darken($details[$side][
'c']);
21105 if ($bSeparate && $cort ==
'table') {
21106 if ($side ==
'T') {
21107 $yadj3 = $this->LineWidth / 2;
21108 $xadj3 = -$this->LineWidth / 2;
21109 $wadj3 = $this->LineWidth;
21111 $xadj3 += $this->LineWidth;
21112 $wadj3 -= $this->LineWidth;
21115 $wadj3 -= $this->LineWidth * 2;
21118 if ($side ==
'L') {
21119 $xadj3 = $this->LineWidth / 2;
21120 $yadj3 = -$this->LineWidth / 2;
21121 $hadj3 = $this->LineWidth;
21123 $yadj3 += $this->LineWidth;
21124 $hadj3 -= $this->LineWidth;
21127 $hadj3 -= $this->LineWidth * 2;
21130 if ($side ==
'B') {
21131 $yadj3 = $this->LineWidth / 2;
21132 $xadj3 = -$this->LineWidth / 2;
21133 $wadj3 = $this->LineWidth;
21135 if ($side ==
'R') {
21136 $xadj3 = $this->LineWidth / 2;
21137 $yadj3 = -$this->LineWidth / 2;
21138 $hadj3 = $this->LineWidth;
21140 } elseif ($side ==
'T') {
21141 $yadj3 = $this->LineWidth / 2;
21142 $xadj3 = $this->LineWidth / 2;
21143 $wadj3 = -$this->LineWidth * 2;
21144 } elseif ($side ==
'L') {
21145 $xadj3 = $this->LineWidth / 2;
21146 $yadj3 = $this->LineWidth / 2;
21147 $hadj3 = -$this->LineWidth * 2;
21148 } elseif ($side ==
'B' && $bSeparate) {
21149 $yadj3 = $this->LineWidth / 2;
21150 $wadj3 = $this->LineWidth / 2;
21151 } elseif ($side ==
'R' && $bSeparate) {
21152 $xadj3 = $this->LineWidth / 2;
21153 $hadj3 = $this->LineWidth / 2;
21154 } elseif ($side ==
'B') {
21155 $yadj3 = $this->LineWidth / 2;
21156 $xadj3 = $this->LineWidth / 2;
21157 } elseif ($side ==
'R') {
21158 $xadj3 = $this->LineWidth / 2;
21159 $yadj3 = $this->LineWidth / 2;
21162 $nc = $this->colorConverter->lighten($details[$side][
'c']);
21164 if ($bSeparate && $cort ==
'table') {
21165 if ($side ==
'T') {
21166 $yadj3 = $this->LineWidth / 2;
21167 $xadj3 = -$this->LineWidth / 2;
21168 $wadj3 = $this->LineWidth;
21170 $xadj3 += $this->LineWidth;
21171 $wadj3 -= $this->LineWidth;
21174 if ($side ==
'L') {
21175 $xadj3 = $this->LineWidth / 2;
21176 $yadj3 = -$this->LineWidth / 2;
21177 $hadj3 = $this->LineWidth;
21179 $yadj3 += $this->LineWidth;
21180 $hadj3 -= $this->LineWidth;
21183 if ($side ==
'B') {
21184 $yadj3 = $this->LineWidth / 2;
21185 $xadj3 = -$this->LineWidth / 2;
21186 $wadj3 = $this->LineWidth;
21188 $xadj3 += $this->LineWidth;
21189 $wadj3 -= $this->LineWidth;
21192 if ($side ==
'R') {
21193 $xadj3 = $this->LineWidth / 2;
21194 $yadj3 = -$this->LineWidth / 2;
21195 $hadj3 = $this->LineWidth;
21197 $yadj3 += $this->LineWidth;
21198 $hadj3 -= $this->LineWidth;
21201 } elseif ($side ==
'T') {
21202 $yadj3 = $this->LineWidth / 2;
21203 $xadj3 = $this->LineWidth / 2;
21204 } elseif ($side ==
'L') {
21205 $xadj3 = $this->LineWidth / 2;
21206 $yadj3 = $this->LineWidth / 2;
21207 } elseif ($side ==
'B' && $bSeparate) {
21208 $yadj3 = $this->LineWidth / 2;
21209 $xadj3 = $this->LineWidth / 2;
21210 } elseif ($side ==
'R' && $bSeparate) {
21211 $xadj3 = $this->LineWidth / 2;
21212 $yadj3 = $this->LineWidth / 2;
21213 } elseif ($side ==
'B') {
21214 $yadj3 = $this->LineWidth / 2;
21215 $xadj3 = -$this->LineWidth / 2;
21216 $wadj3 = $this->LineWidth;
21217 } elseif ($side ==
'R') {
21218 $xadj3 = $this->LineWidth / 2;
21219 $yadj3 = -$this->LineWidth / 2;
21220 $hadj3 = $this->LineWidth;
21225 $cellBorderOverlay[] = [
21226 'x' => $lx1 + $xadj + $xadj3,
21227 'y' => $ly1 + $yadj + $yadj3,
21228 'x2' => $lx2 - $xadj2 + $xadj3 + $wadj3,
21229 'y2' => $ly2 - $yadj2 + $yadj3 + $hadj3,
21231 'lw' => $this->LineWidth,
21234 $this->SetDColor($nc);
21235 $this->Line($lx1 + $xadj + $xadj3, $ly1 + $yadj + $yadj3, $lx2 - $xadj2 + $xadj3 + $wadj3, $ly2 - $yadj2 + $yadj3 + $hadj3);
21240 if ($details[$side][
'style'] ==
'dashed') {
21243 $this->SetDash($dashsize, ($dashsize / $dashsizek) + ($this->LineWidth * 2));
21244 } elseif ($details[$side][
'style'] ==
'dotted') {
21245 $this->SetLineJoin(1);
21246 $this->SetLineCap(1);
21247 $this->SetDash(0.001, ($this->LineWidth * 2));
21249 if ($details[$side][
'c']) {
21250 $this->SetDColor($details[$side][
'c']);
21252 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
21254 $this->Line($lx1 + $xadj, $ly1 + $yadj, $lx2 - $xadj2, $ly2 - $yadj2);
21262 $this->SetLineCap(2);
21266 if ($bSeparate && count($cellBorderOverlay)) {
21267 foreach ($cellBorderOverlay as $cbo) {
21269 $this->SetDColor($cbo[
'col']);
21270 $this->Line($cbo[
'x'], $cbo[
'y'], $cbo[
'x2'], $cbo[
'y2']);
21286 $flag = intval($flag);
21290 $var = intval($var);
21291 $var = $set ? ($var | $flag) : ($var & ~$flag);
21296 $flag = intval($flag);
21297 $var = intval($var);
21298 return (($var & $flag) == $flag);
21303 if ($tableb && $tableb[
'w'] > $cbdb[
'w']) {
21305 $this->setBorder($cellb, $bval);
21306 } elseif ($tableb && $tableb[
'w'] == $cbdb[
'w'] && array_search($tableb[
'style'], $this->borderstyles) > array_search($cbdb[
'style'], $this->borderstyles)) {
21308 $this->setBorder($cellb, $bval);
21315 if (!$table[
'borders_separate'] && $table[
'border_details'][
'L'][
'w']) {
21316 $table[
'max_cell_border_width'][
'L'] = $table[
'border_details'][
'L'][
'w'];
21318 if (!$table[
'borders_separate'] && $table[
'border_details'][
'R'][
'w']) {
21319 $table[
'max_cell_border_width'][
'R'] = $table[
'border_details'][
'R'][
'w'];
21321 if (!$table[
'borders_separate'] && $table[
'border_details'][
'T'][
'w']) {
21322 $table[
'max_cell_border_width'][
'T'] = $table[
'border_details'][
'T'][
'w'];
21324 if (!$table[
'borders_separate'] && $table[
'border_details'][
'B'][
'w']) {
21325 $table[
'max_cell_border_width'][
'B'] = $table[
'border_details'][
'B'][
'w'];
21327 if ($this->simpleTables) {
21330 $cells = &$table[
'cells'];
21331 $numcols = $table[
'nc'];
21332 $numrows = $table[
'nr'];
21334 if (isset($table[
'topntail']) && $table[
'topntail']) {
21335 $tntborddet = $this->border_details($table[
'topntail']);
21337 if (isset($table[
'thead-underline']) && $table[
'thead-underline']) {
21338 $thuborddet = $this->border_details($table[
'thead-underline']);
21342 for ($i = 0; $i < $numrows; $i++) {
21343 for ($j = 0; $j < $numcols; $j++) {
21344 if (isset($cells[$i][$j]) && $cells[$i][$j]) {
21345 $cell = &$cells[$i][$j];
21346 if ($this->packTableData) {
21347 $cbord = $this->_unpackCellBorder($cell[
'borderbin']);
21349 $cbord = &$cells[$i][$j];
21353 if (!$cbord[
'border'] && $cbord[
'border'] !== 0 && isset($table[
'border']) && $table[
'border'] && $this->table_border_attr_set) {
21354 $cbord[
'border'] = $table[
'border'];
21355 $cbord[
'border_details'] = $table[
'border_details'];
21358 if (isset($cell[
'colspan']) && $cell[
'colspan'] > 1) {
21359 $ccolsp = $cell[
'colspan'];
21363 if (isset($cell[
'rowspan']) && $cell[
'rowspan'] > 1) {
21364 $crowsp = $cell[
'rowspan'];
21369 $cbord[
'border_details'][
'cellposdom'] = ((($i + 1) / $numrows) / 10000 ) + ((($j + 1) / $numcols) / 10 );
21371 if ($this->table_border_css_set && !$table[
'borders_separate']) {
21373 $this->_table2cellBorder($table[
'border_details'][
'T'], $cbord[
'border_details'][
'T'], $cbord[
'border'],
Border::TOP);
21375 if ($i == ($numrows - 1) || ($i + $crowsp) == ($numrows)) {
21376 $this->_table2cellBorder($table[
'border_details'][
'B'], $cbord[
'border_details'][
'B'], $cbord[
'border'],
Border::BOTTOM);
21379 $this->_table2cellBorder($table[
'border_details'][
'L'], $cbord[
'border_details'][
'L'], $cbord[
'border'],
Border::LEFT);
21381 if ($j == ($numcols - 1) || ($j + $ccolsp) == ($numcols)) {
21382 $this->_table2cellBorder($table[
'border_details'][
'R'], $cbord[
'border_details'][
'R'], $cbord[
'border'],
Border::RIGHT);
21388 if (isset($table[
'topntail']) && $table[
'topntail']) {
21390 $cbord[
'border_details'][
'T'] = $tntborddet;
21393 if ($this->tableLevel == 1 && $table[
'headernrows'] > 0 && $i == $table[
'headernrows'] - 1) {
21394 $cbord[
'border_details'][
'B'] = $tntborddet;
21396 $fixbottom =
false;
21397 } elseif ($this->tableLevel == 1 && $table[
'headernrows'] > 0 && $i == $table[
'headernrows']) {
21398 if (!$table[
'borders_separate']) {
21399 $cbord[
'border_details'][
'T'] = $tntborddet;
21403 if ($this->tableLevel == 1 && $table[
'footernrows'] > 0 && $i == ($numrows - $table[
'footernrows'] - 1)) {
21404 if (!$table[
'borders_separate']) {
21405 $cbord[
'border_details'][
'B'] = $tntborddet;
21407 $fixbottom =
false;
21409 } elseif ($this->tableLevel == 1 && $table[
'footernrows'] > 0 && $i == ($numrows - $table[
'footernrows'])) {
21410 $cbord[
'border_details'][
'T'] = $tntborddet;
21413 if ($this->tabletheadjustfinished) {
21414 if (!$table[
'borders_separate']) {
21415 $cbord[
'border_details'][
'T'] = $tntborddet;
21419 if ($i == ($numrows - 1) || ($i + $crowsp) == ($numrows)) {
21420 $cbord[
'border_details'][
'B'] = $tntborddet;
21424 if (isset($table[
'thead-underline']) && $table[
'thead-underline']) {
21425 if ($table[
'borders_separate']) {
21427 $cbord[
'border_details'][
'B'] = $thuborddet;
21429 $fixbottom =
false;
21432 if ($this->tableLevel == 1 && $table[
'headernrows'] > 0 && $i == $table[
'headernrows'] - 1) {
21433 $cbord[
'border_details'][
'T'] = $thuborddet;
21435 } elseif ($this->tabletheadjustfinished) {
21436 $cbord[
'border_details'][
'T'] = $thuborddet;
21447 if (!$table[
'borders_separate']) {
21449 if (($i < ($numrows - 1) || ($i + $crowsp) < $numrows ) && $fixbottom) {
21451 for ($cspi = 0; $cspi < $ccolsp; $cspi++) {
21454 if (isset($cells[($i + $crowsp)][$j + $cspi])) {
21455 if ($this->packTableData) {
21456 $adjc = $cells[($i + $crowsp)][$j + $cspi];
21457 $celladj = $this->_unpackCellBorder($adjc[
'borderbin']);
21459 $celladj = & $cells[($i + $crowsp)][$j + $cspi];
21465 if (isset($celladj[
'border_details'][
'T'][
's']) && $celladj[
'border_details'][
'T'][
's'] == 1) {
21467 $csadj = $celladj[
'border_details'][
'T'][
'w'];
21468 $csthis = $cbord[
'border_details'][
'B'][
'w'];
21471 if ($cbord[
'border_details'][
'B'][
'style'] ==
'hidden') {
21473 $celladj[
'border_details'][
'T'] = $cbord[
'border_details'][
'B'];
21474 $this->setBorder($celladj[
'border'],
Border::TOP,
false);
21477 } elseif ($celladj[
'border_details'][
'T'][
'style'] ==
'hidden') {
21479 $cbord[
'border_details'][
'B'] = $celladj[
'border_details'][
'T'];
21481 $this->setBorder($celladj[
'border'],
Border::TOP,
false);
21483 } elseif ($csthis > $csadj) {
21485 if (!isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) || (isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) && $cells[($i + $crowsp)][$j + $cspi][
'colspan'] < 2)) {
21486 $celladj[
'border_details'][
'T'] = $cbord[
'border_details'][
'B'];
21490 } elseif ($csadj > $csthis) {
21493 $cbord[
'border_details'][
'B'] = $celladj[
'border_details'][
'T'];
21494 $this->setBorder($celladj[
'border'],
Border::TOP);
21497 } elseif (array_search($cbord[
'border_details'][
'B'][
'style'], $this->borderstyles) > array_search($celladj[
'border_details'][
'T'][
'style'], $this->borderstyles)) {
21499 if (!isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) || (isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) && $cells[($i + $crowsp)][$j + $cspi][
'colspan'] < 2)) {
21500 $celladj[
'border_details'][
'T'] = $cbord[
'border_details'][
'B'];
21504 } elseif (array_search($celladj[
'border_details'][
'T'][
'style'], $this->borderstyles) > array_search($cbord[
'border_details'][
'B'][
'style'], $this->borderstyles)) {
21507 $cbord[
'border_details'][
'B'] = $celladj[
'border_details'][
'T'];
21508 $this->setBorder($celladj[
'border'],
Border::TOP);
21511 } elseif ($celladj[
'border_details'][
'T'][
'dom'] > $celladj[
'border_details'][
'B'][
'dom']) {
21514 $cbord[
'border_details'][
'B'] = $celladj[
'border_details'][
'T'];
21515 $this->setBorder($celladj[
'border'],
Border::TOP);
21520 if (!isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) || (isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) && $cells[($i + $crowsp)][$j + $cspi][
'colspan'] < 2)) {
21521 $celladj[
'border_details'][
'T'] = $cbord[
'border_details'][
'B'];
21527 } elseif ($celladj) {
21529 if (!isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) || (isset($cells[($i + $crowsp)][$j + $cspi][
'colspan']) && $cells[($i + $crowsp)][$j + $cspi][
'colspan'] < 2)) {
21530 $celladj[
'border_details'][
'T'] = $cbord[
'border_details'][
'B'];
21536 if ($celladj && $this->packTableData) {
21537 $cells[$i + $crowsp][$j + $cspi][
'borderbin'] = $this->_packCellBorder($celladj);
21544 if ($j < ($numcols - 1) || ($j + $ccolsp) < $numcols) {
21546 for ($cspi = 0; $cspi < $crowsp; $cspi++) {
21549 if (isset($cells[($i + $cspi)][$j + $ccolsp])) {
21550 if ($this->packTableData) {
21551 $adjc = $cells[($i + $cspi)][$j + $ccolsp];
21552 $celladj = $this->_unpackCellBorder($adjc[
'borderbin']);
21554 $celladj = & $cells[$i + $cspi][$j + $ccolsp];
21559 if ($celladj && $celladj[
'border_details'][
'L'][
's'] == 1) {
21560 $csadj = $celladj[
'border_details'][
'L'][
'w'];
21561 $csthis = $cbord[
'border_details'][
'R'][
'w'];
21563 if ($cbord[
'border_details'][
'R'][
'style'] ==
'hidden') {
21564 $celladj[
'border_details'][
'L'] = $cbord[
'border_details'][
'R'];
21565 $this->setBorder($celladj[
'border'],
Border::LEFT,
false);
21567 } elseif ($celladj[
'border_details'][
'L'][
'style'] ==
'hidden') {
21568 $cbord[
'border_details'][
'R'] = $celladj[
'border_details'][
'L'];
21570 $this->setBorder($celladj[
'border'],
Border::LEFT,
false);
21572 elseif ($csthis > $csadj) {
21573 if (!isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) || (isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) && $cells[($i + $cspi)][$j + $ccolsp][
'rowspan'] < 2)) {
21574 $celladj[
'border_details'][
'L'] = $cbord[
'border_details'][
'R'];
21576 $this->setBorder($celladj[
'border'],
Border::LEFT,
false);
21578 } elseif ($csadj > $csthis) {
21580 $cbord[
'border_details'][
'R'] = $celladj[
'border_details'][
'L'];
21585 elseif (array_search($cbord[
'border_details'][
'R'][
'style'], $this->borderstyles) > array_search($celladj[
'border_details'][
'L'][
'style'], $this->borderstyles)) {
21586 if (!isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) || (isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) && $cells[($i + $cspi)][$j + $ccolsp][
'rowspan'] < 2)) {
21587 $celladj[
'border_details'][
'L'] = $cbord[
'border_details'][
'R'];
21588 $this->setBorder($celladj[
'border'],
Border::LEFT,
false);
21591 } elseif (array_search($celladj[
'border_details'][
'L'][
'style'], $this->borderstyles) > array_search($cbord[
'border_details'][
'R'][
'style'], $this->borderstyles)) {
21593 $cbord[
'border_details'][
'R'] = $celladj[
'border_details'][
'L'];
21598 elseif ($celladj[
'border_details'][
'L'][
'dom'] > $cbord[
'border_details'][
'R'][
'dom']) {
21600 $cbord[
'border_details'][
'R'] = $celladj[
'border_details'][
'L'];
21605 if (!isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) || (isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) && $cells[($i + $cspi)][$j + $ccolsp][
'rowspan'] < 2)) {
21606 $celladj[
'border_details'][
'L'] = $cbord[
'border_details'][
'R'];
21610 } elseif ($celladj) {
21612 if (!isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) || (isset($cells[($i + $cspi)][$j + $ccolsp][
'rowspan']) && $cells[($i + $cspi)][$j + $ccolsp][
'rowspan'] < 2)) {
21613 $celladj[
'border_details'][
'L'] = $cbord[
'border_details'][
'R'];
21617 if ($celladj && $this->packTableData) {
21618 $cells[$i + $cspi][$j + $ccolsp][
'borderbin'] = $this->_packCellBorder($celladj);
21628 if (!$table[
'borders_separate']) {
21630 $cbord[
'border_details'][
'mbw'][
'BL'] = max($cbord[
'border_details'][
'mbw'][
'BL'], $cbord[
'border_details'][
'L'][
'w']);
21631 $cbord[
'border_details'][
'mbw'][
'BR'] = max($cbord[
'border_details'][
'mbw'][
'BR'], $cbord[
'border_details'][
'R'][
'w']);
21632 $cbord[
'border_details'][
'mbw'][
'RT'] = max($cbord[
'border_details'][
'mbw'][
'RT'], $cbord[
'border_details'][
'T'][
'w']);
21633 $cbord[
'border_details'][
'mbw'][
'RB'] = max($cbord[
'border_details'][
'mbw'][
'RB'], $cbord[
'border_details'][
'B'][
'w']);
21634 $cbord[
'border_details'][
'mbw'][
'TL'] = max($cbord[
'border_details'][
'mbw'][
'TL'], $cbord[
'border_details'][
'L'][
'w']);
21635 $cbord[
'border_details'][
'mbw'][
'TR'] = max($cbord[
'border_details'][
'mbw'][
'TR'], $cbord[
'border_details'][
'R'][
'w']);
21636 $cbord[
'border_details'][
'mbw'][
'LT'] = max($cbord[
'border_details'][
'mbw'][
'LT'], $cbord[
'border_details'][
'T'][
'w']);
21637 $cbord[
'border_details'][
'mbw'][
'LB'] = max($cbord[
'border_details'][
'mbw'][
'LB'], $cbord[
'border_details'][
'B'][
'w']);
21639 if (($i + $crowsp) < $numrows && isset($cells[$i + $crowsp][$j])) {
21641 if ($this->packTableData) {
21642 $adjc = $cells[$i + $crowsp][$j];
21643 $celladj = $this->_unpackCellBorder($adjc[
'borderbin']);
21645 $celladj = & $cells[$i + $crowsp][$j];
21648 $cbord[
'border_details'][
'mbw'][
'BL'] = max(
21649 $cbord[
'border_details'][
'mbw'][
'BL'],
21650 $celladj ? $celladj[
'border_details'][
'L'][
'w'] : 0,
21651 $celladj ? $celladj[
'border_details'][
'mbw'][
'TL']: 0
21654 $cbord[
'border_details'][
'mbw'][
'BR'] = max(
21655 $cbord[
'border_details'][
'mbw'][
'BR'],
21656 $celladj ? $celladj[
'border_details'][
'R'][
'w'] : 0,
21657 $celladj ? $celladj[
'border_details'][
'mbw'][
'TR']: 0
21660 $cbord[
'border_details'][
'mbw'][
'LB'] = max(
21661 $cbord[
'border_details'][
'mbw'][
'LB'],
21662 $celladj ? $celladj[
'border_details'][
'mbw'][
'LT'] : 0
21665 $cbord[
'border_details'][
'mbw'][
'RB'] = max(
21666 $cbord[
'border_details'][
'mbw'][
'RB'],
21667 $celladj ? $celladj[
'border_details'][
'mbw'][
'RT'] : 0
21673 if (($j + $ccolsp) < $numcols && isset($cells[$i][$j + $ccolsp])) {
21675 if ($this->packTableData) {
21676 $adjc = $cells[$i][$j + $ccolsp];
21677 $celladj = $this->_unpackCellBorder($adjc[
'borderbin']);
21679 $celladj = & $cells[$i][$j + $ccolsp];
21682 $cbord[
'border_details'][
'mbw'][
'RT'] = max(
21683 $cbord[
'border_details'][
'mbw'][
'RT'],
21684 $celladj ? $celladj[
'border_details'][
'T'][
'w'] : 0,
21685 $celladj ? $celladj[
'border_details'][
'mbw'][
'LT'] : 0
21688 $cbord[
'border_details'][
'mbw'][
'RB'] = max(
21689 $cbord[
'border_details'][
'mbw'][
'RB'],
21690 $celladj ? $celladj[
'border_details'][
'B'][
'w'] : 0,
21691 $celladj ? $celladj[
'border_details'][
'mbw'][
'LB'] : 0
21694 $cbord[
'border_details'][
'mbw'][
'TR'] = max(
21695 $cbord[
'border_details'][
'mbw'][
'TR'],
21696 $celladj ? $celladj[
'border_details'][
'mbw'][
'TL'] : 0
21699 $cbord[
'border_details'][
'mbw'][
'BR'] = max(
21700 $cbord[
'border_details'][
'mbw'][
'BR'],
21701 $celladj ? $celladj[
'border_details'][
'mbw'][
'BL'] : 0
21707 if ($i > 0 && isset($cells[$i - 1][$j]) && is_array($cells[$i - 1][$j]) && (($this->packTableData && $cells[$i - 1][$j][
'borderbin']) || $cells[$i - 1][$j][
'border'])) {
21709 if ($this->packTableData) {
21710 $adjc = $cells[$i - 1][$j];
21711 $celladj = $this->_unpackCellBorder($adjc[
'borderbin']);
21713 $celladj = & $cells[$i - 1][$j];
21716 $cbord[
'border_details'][
'mbw'][
'TL'] = max(
21717 $cbord[
'border_details'][
'mbw'][
'TL'],
21718 $celladj ? $celladj[
'border_details'][
'L'][
'w'] : 0,
21719 $celladj ? $celladj[
'border_details'][
'mbw'][
'BL'] : 0
21722 $cbord[
'border_details'][
'mbw'][
'TR'] = max(
21723 $cbord[
'border_details'][
'mbw'][
'TR'],
21724 $celladj ? $celladj[
'border_details'][
'R'][
'w'] : 0,
21725 $celladj ? $celladj[
'border_details'][
'mbw'][
'BR'] : 0
21728 $cbord[
'border_details'][
'mbw'][
'LT'] = max(
21729 $cbord[
'border_details'][
'mbw'][
'LT'],
21730 $celladj ? $celladj[
'border_details'][
'mbw'][
'LB'] : 0
21733 $cbord[
'border_details'][
'mbw'][
'RT'] = max(
21734 $cbord[
'border_details'][
'mbw'][
'RT'],
21735 $celladj ? $celladj[
'border_details'][
'mbw'][
'RB'] : 0
21738 if ($celladj[
'border_details'][
'mbw'][
'BL']) {
21739 $celladj[
'border_details'][
'mbw'][
'BL'] = max($cbord[
'border_details'][
'mbw'][
'TL'], $celladj[
'border_details'][
'mbw'][
'BL']);
21742 if ($celladj[
'border_details'][
'mbw'][
'BR']) {
21743 $celladj[
'border_details'][
'mbw'][
'BR'] = max($celladj[
'border_details'][
'mbw'][
'BR'], $cbord[
'border_details'][
'mbw'][
'TR']);
21746 if ($this->packTableData) {
21747 $cells[$i - 1][$j][
'borderbin'] = $this->_packCellBorder($celladj);
21752 if ($j > 0 && isset($cells[$i][$j - 1]) && is_array($cells[$i][$j - 1]) && (($this->packTableData && $cells[$i][$j - 1][
'borderbin']) || $cells[$i][$j - 1][
'border'])) {
21754 if ($this->packTableData) {
21755 $adjc = $cells[$i][$j - 1];
21756 $celladj = $this->_unpackCellBorder($adjc[
'borderbin']);
21758 $celladj = & $cells[$i][$j - 1];
21761 $cbord[
'border_details'][
'mbw'][
'LT'] = max(
21762 $cbord[
'border_details'][
'mbw'][
'LT'],
21763 $celladj ? $celladj[
'border_details'][
'T'][
'w'] : 0,
21764 $celladj ? $celladj[
'border_details'][
'mbw'][
'RT'] : 0
21767 $cbord[
'border_details'][
'mbw'][
'LB'] = max(
21768 $cbord[
'border_details'][
'mbw'][
'LB'],
21769 $celladj ? $celladj[
'border_details'][
'B'][
'w'] : 0,
21770 $celladj ? $celladj[
'border_details'][
'mbw'][
'RB'] : 0
21773 $cbord[
'border_details'][
'mbw'][
'BL'] = max(
21774 $cbord[
'border_details'][
'mbw'][
'BL'],
21775 $celladj ? $celladj[
'border_details'][
'mbw'][
'BR'] : 0
21778 $cbord[
'border_details'][
'mbw'][
'TL'] = max(
21779 $cbord[
'border_details'][
'mbw'][
'TL'],
21780 $celladj ? $celladj[
'border_details'][
'mbw'][
'TR'] : 0
21783 if ($celladj[
'border_details'][
'mbw'][
'RT']) {
21784 $celladj[
'border_details'][
'mbw'][
'RT'] = max($celladj[
'border_details'][
'mbw'][
'RT'], $cbord[
'border_details'][
'mbw'][
'LT']);
21787 if ($celladj[
'border_details'][
'mbw'][
'RB']) {
21788 $celladj[
'border_details'][
'mbw'][
'RB'] = max($celladj[
'border_details'][
'mbw'][
'RB'], $cbord[
'border_details'][
'mbw'][
'LB']);
21791 if ($this->packTableData) {
21792 $cells[$i][$j - 1][
'borderbin'] = $this->_packCellBorder($celladj);
21800 if ($j == 0 && $cbord[
'border_details'][
'L'][
'w']) {
21801 $table[
'max_cell_border_width'][
'L'] = max($table[
'max_cell_border_width'][
'L'], $cbord[
'border_details'][
'L'][
'w']);
21803 if (($j == ($numcols - 1) || ($j + $ccolsp) == $numcols ) && $cbord[
'border_details'][
'R'][
'w']) {
21804 $table[
'max_cell_border_width'][
'R'] = max($table[
'max_cell_border_width'][
'R'], $cbord[
'border_details'][
'R'][
'w']);
21806 if ($i == 0 && $cbord[
'border_details'][
'T'][
'w']) {
21807 $table[
'max_cell_border_width'][
'T'] = max($table[
'max_cell_border_width'][
'T'], $cbord[
'border_details'][
'T'][
'w']);
21809 if (($i == ($numrows - 1) || ($i + $crowsp) == $numrows ) && $cbord[
'border_details'][
'B'][
'w']) {
21810 $table[
'max_cell_border_width'][
'B'] = max($table[
'max_cell_border_width'][
'B'], $cbord[
'border_details'][
'B'][
'w']);
21815 if ($this->packTableData) {
21816 $cell[
'borderbin'] = $this->_packCellBorder($cbord);
21832 $cells = &$table[
'cells'];
21833 $numcols = $table[
'nc'];
21834 $numrows = $table[
'nr'];
21835 for ($i = 0; $i < $numrows; $i++) {
21837 for ($j = ($numcols - 1); $j >= 0; $j--) {
21838 if (isset($cells[$i][$j]) && $cells[$i][$j]) {
21839 $cell = &$cells[$i][$j];
21840 $col = $numcols - $j - 1;
21841 if (isset($cell[
'colspan']) && $cell[
'colspan'] > 1) {
21842 $col -= ($cell[
'colspan'] - 1);
21845 if (isset($cell[
'textbuffer'])) {
21846 for ($n = 0; $n < count($cell[
'textbuffer']); $n++) {
21847 $t = $cell[
'textbuffer'][$n][0];
21848 if (substr($t, 0, 19) ==
"\xbb\xa4\xactype=nestedtable") {
21849 $objattr = $this->_getObjAttr($t);
21850 $objattr[
'col'] = $col;
21851 $cell[
'textbuffer'][$n][0] =
"\xbb\xa4\xactype=nestedtable,objattr=" . serialize($objattr) .
"\xbb\xa4\xac";
21852 $this->table[($this->tableLevel + 1)][$objattr[
'nestedcontent']][
'nestedpos'][1] = $col;
21856 $row[$col] = $cells[$i][$j];
21860 for ($f = 0; $f < $numcols; $f++) {
21861 if (!isset($row[$f])) {
21865 $table[
'cells'][$i] = $row;
21869 function _tableWrite(&$table, $split =
false, $startrow = 0, $startcol = 0, $splitpg = 0, $rety = 0)
21871 $level = $table[
'level'];
21872 $levelid = $table[
'levelid'];
21874 $cells = &$table[
'cells'];
21875 $numcols = $table[
'nc'];
21876 $numrows = $table[
'nr'];
21878 if ($this->ColActive && $level == 1) {
21879 $this->breakpoints[$this->CurrCol][] = $this->y;
21882 if (!$split || ($startrow == 0 && $splitpg == 0) || $startrow > 0) {
21884 if ($table[
'margin'][
'T']) {
21885 if (!$this->table_rotate && $level == 1) {
21886 $this->DivLn($table[
'margin'][
'T'], $this->blklvl,
true, 1);
21888 $this->y += ($table[
'margin'][
'T']);
21892 if ($table[
'borders_separate']) {
21893 if ($startrow > 0 && (!isset($table[
'is_thead']) || count($table[
'is_thead']) == 0)) {
21894 $adv = $table[
'border_spacing_V'] / 2;
21896 $adv = $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'] + $table[
'border_spacing_V'] / 2;
21899 $adv = $table[
'max_cell_border_width'][
'T'] / 2;
21901 if (!$this->table_rotate && $level == 1) {
21902 $this->DivLn($adv);
21909 $this->x = $this->lMargin + $this->blk[$this->blklvl][
'outer_left_margin'] + $this->blk[$this->blklvl][
'padding_left'] + $this->blk[$this->blklvl][
'border_left'][
'w'];
21912 $right = $x0 + $this->blk[$this->blklvl][
'inner_width'];
21913 $outerfilled = $this->y;
21914 $this->outerfilled = $this->y;
21915 $this->colsums = [];
21919 $right = $x0 + $table[
'w'];
21922 if ($this->table_rotate) {
21923 $temppgwidth = $this->tbrot_maxw;
21924 $this->PageBreakTrigger = $pagetrigger = $y0 + ($this->blk[$this->blklvl][
'inner_width']);
21926 $this->tbrot_y0 = $this->y - $adv - $table[
'margin'][
'T'];
21927 $this->tbrot_x0 = $this->x;
21928 $this->tbrot_w = $table[
'w'];
21929 if ($table[
'borders_separate']) {
21930 $this->tbrot_h = $table[
'margin'][
'T'] + $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'] + $table[
'border_spacing_V'] / 2;
21932 $this->tbrot_h = $table[
'margin'][
'T'] + $table[
'padding'][
'T'] + $table[
'max_cell_border_width'][
'T'];
21936 $this->PageBreakTrigger = $pagetrigger = ($this->h - $this->bMargin);
21938 $temppgwidth = $this->blk[$this->blklvl][
'inner_width'];
21939 if (isset($table[
'a']) and ( $table[
'w'] < $this->blk[$this->blklvl][
'inner_width'])) {
21940 if ($table[
'a'] ==
'C') {
21941 $x0 += ((($right - $x0) - $table[
'w']) / 2);
21942 } elseif ($table[
'a'] ==
'R') {
21943 $x0 = $right - $table[
'w'];
21947 $temppgwidth = $table[
'w'];
21950 if (!isset($table[
'overflow'])) {
21951 $table[
'overflow'] =
null;
21953 if ($table[
'overflow'] ==
'hidden' && $level == 1 && !$this->table_rotate && !$this->ColActive) {
21955 $this->tableClipPath = sprintf(
'q %.3F %.3F %.3F %.3F re W n', $x0 * Mpdf::SCALE, $this->h * Mpdf::SCALE, $this->blk[$this->blklvl][
'inner_width'] * Mpdf::SCALE, -$this->h * Mpdf::SCALE);
21956 $this->writer->write($this->tableClipPath);
21958 $this->tableClipPath =
'';
21962 if ($table[
'borders_separate']) {
21963 $indent = $table[
'margin'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'L'] + $table[
'border_spacing_H'] / 2;
21965 $indent = $table[
'margin'][
'L'] + $table[
'max_cell_border_width'][
'L'] / 2;
21973 $tableheaderrowheight = 0;
21974 $tablefooterrowheight = 0;
21978 if (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
21979 $tablestartpage =
'EVEN';
21980 } elseif (($this->mirrorMargins) && (($this->page) % 2 == 1)) {
21981 $tablestartpage =
'ODD';
21983 $tablestartpage =
'';
21985 if ($this->ColActive) {
21986 $tablestartcolumn = $this->CurrCol;
21988 $tablestartcolumn =
'';
21992 for ($i = 0; $i < $numrows; $i++) {
21993 if (isset($table[
'is_tfoot'][$i]) && $table[
'is_tfoot'][$i] && $level == 1) {
21994 $tablefooterrowheight += $table[
'hr'][$i];
21995 $tablefooter[$i][0][
'trbackground-images'] = $table[
'trbackground-images'][$i];
21996 $tablefooter[$i][0][
'trgradients'] = $table[
'trgradients'][$i];
21997 $tablefooter[$i][0][
'trbgcolor'] = $table[
'bgcolor'][$i];
21998 for ($j = $startcol; $j < $numcols; $j++) {
21999 if (isset($cells[$i][$j]) && $cells[$i][$j]) {
22000 $cell = &$cells[$i][$j];
22002 if ($table[
'colPg'][$j] != $splitpg) {
22005 list($x, $w) = $this->_splitTableGetWidth($table, $i, $j);
22006 $js = $j - $startcol;
22008 list($x, $w) = $this->_tableGetWidth($table, $i, $j);
22012 list($y, $h) = $this->_tableGetHeight($table, $i, $j);
22016 $tablefooter[$i][$js][
'x'] = $x;
22017 $tablefooter[$i][$js][
'y'] = $y;
22018 $tablefooter[$i][$js][
'h'] = $h;
22019 $tablefooter[$i][$js][
'w'] = $w;
22020 if (isset($cell[
'textbuffer'])) {
22021 $tablefooter[$i][$js][
'textbuffer'] = $cell[
'textbuffer'];
22023 $tablefooter[$i][$js][
'textbuffer'] =
'';
22025 $tablefooter[$i][$js][
'a'] = $cell[
'a'];
22026 $tablefooter[$i][$js][
'R'] = $cell[
'R'];
22027 $tablefooter[$i][$js][
'va'] = $cell[
'va'];
22028 $tablefooter[$i][$js][
'mih'] = $cell[
'mih'];
22029 if (isset($cell[
'gradient'])) {
22030 $tablefooter[$i][$js][
'gradient'] = $cell[
'gradient'];
22032 if (isset($cell[
'background-image'])) {
22033 $tablefooter[$i][$js][
'background-image'] = $cell[
'background-image'];
22037 if (!$this->simpleTables) {
22038 if ($this->packTableData) {
22039 $c = $this->_unpackCellBorder($cell[
'borderbin']);
22040 $tablefooter[$i][$js][
'border'] = $c[
'border'];
22041 $tablefooter[$i][$js][
'border_details'] = $c[
'border_details'];
22043 $tablefooter[$i][$js][
'border'] = $cell[
'border'];
22044 $tablefooter[$i][$js][
'border_details'] = $cell[
'border_details'];
22046 } elseif ($this->simpleTables) {
22047 $tablefooter[$i][$js][
'border'] = $table[
'simple'][
'border'];
22048 $tablefooter[$i][$js][
'border_details'] = $table[
'simple'][
'border_details'];
22050 $tablefooter[$i][$js][
'bgcolor'] = $cell[
'bgcolor'];
22051 $tablefooter[$i][$js][
'padding'] = $cell[
'padding'];
22052 if (isset($cell[
'rowspan'])) {
22053 $tablefooter[$i][$js][
'rowspan'] = $cell[
'rowspan'];
22055 if (isset($cell[
'colspan'])) {
22056 $tablefooter[$i][$js][
'colspan'] = $cell[
'colspan'];
22058 if (isset($cell[
'direction'])) {
22059 $tablefooter[$i][$js][
'direction'] = $cell[
'direction'];
22061 if (isset($cell[
'cellLineHeight'])) {
22062 $tablefooter[$i][$js][
'cellLineHeight'] = $cell[
'cellLineHeight'];
22064 if (isset($cell[
'cellLineStackingStrategy'])) {
22065 $tablefooter[$i][$js][
'cellLineStackingStrategy'] = $cell[
'cellLineStackingStrategy'];
22067 if (isset($cell[
'cellLineStackingShift'])) {
22068 $tablefooter[$i][$js][
'cellLineStackingShift'] = $cell[
'cellLineStackingShift'];
22076 $this->writer->write(
'___TABLE___BACKGROUNDS' . $this->uniqstr);
22078 $tableheaderadj = 0;
22079 $tablefooteradj = 0;
22081 $tablestartpageno = $this->page;
22084 for ($i = 0; $i < $numrows; $i++) {
22085 if ($split && $startrow > 0) {
22086 $thnr = (isset($table[
'is_thead']) ? count($table[
'is_thead']) : 0);
22087 if ($i >= $thnr && $i < $startrow) {
22090 if ($i == $startrow) {
22091 $returny = $rety - $tableheaderrowheight;
22096 $maxrowheight = $this->_tableGetMaxRowHeight($table, $i);
22099 $newpagestarted =
false;
22100 for ($j = $startcol; $j < $numcols; $j++) {
22102 if ($table[
'colPg'][$j] > $splitpg) {
22107 if (isset($cells[$i][$j]) && $cells[$i][$j]) {
22108 $cell = &$cells[$i][$j];
22110 $lastCol = $j + (isset($cell[
'colspan']) ? ($cell[
'colspan'] - 1) : 0);
22111 list($x, $w) = $this->_splitTableGetWidth($table, $i, $j);
22113 list($x, $w) = $this->_tableGetWidth($table, $i, $j);
22116 list($y, $h) = $this->_tableGetHeight($table, $i, $j);
22121 if ($table[
'borders_separate']) {
22122 if (!empty($tablefooter) || $i == ($numrows - 1) || (isset($cell[
'rowspan']) && ($i + $cell[
'rowspan']) == $numrows) || (!isset($cell[
'rowspan']) && ($i + 1) == $numrows)) {
22123 $extra = $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] / 2;
22126 $extra = $table[
'border_spacing_V'] / 2;
22129 $extra = $table[
'max_cell_border_width'][
'B'] / 2;
22132 if ($j == $startcol && ((($y + $maxrowheight + $extra ) > ($pagetrigger + 0.001)) || (($this->keepColumns || !$this->ColActive) && !empty($tablefooter) && ($y + $maxrowheight + $tablefooterrowheight + $extra) > $pagetrigger) && ($this->tableLevel == 1 && $i < ($numrows - $table[
'headernrows']))) && ($y0 > 0 || $x0 > 0) && !$this->InFooter && $this->autoPageBreak) {
22134 $finalSpread =
true;
22135 $firstSpread =
true;
22137 for ($t = $startcol; $t < $numcols; $t++) {
22139 if ($table[
'colPg'][$t] > $splitpg) {
22140 $finalSpread =
false;
22144 if ($startcol > 0) {
22145 $firstSpread =
false;
22149 if (($this->keepColumns || !$this->ColActive) && !empty($tablefooter) && $i > 0) {
22152 $this->TableHeaderFooter($tablefooter, $tablestartpage, $tablestartcolumn,
'F', $level, $firstSpread, $finalSpread);
22153 if ($this->table_rotate) {
22154 $this->tbrot_h += $this->y - $ya;
22156 $tablefooteradj = $this->y - $ya;
22161 $oldcolumn = $this->CurrCol;
22162 if ($this->AcceptPageBreak()) {
22163 $newpagestarted =
true;
22164 $this->y = $y + $y0;
22168 if ($i > 0 && !$this->table_rotate && $level == 1 && !$this->ColActive) {
22169 if ($table[
'borders_separate']) {
22170 $adv = $table[
'border_spacing_V'] / 2;
22172 if (($this->keepColumns || !$this->ColActive) && !empty($tablefooter) && $i > 0) {
22173 $adv += ($table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w']);
22178 if (!$this->simpleTables) {
22179 if (!empty($tablefooter)) {
22180 $maxbwbottom = $table[
'max_cell_border_width'][
'B'];
22183 for ($ctj = 0; $ctj < $numcols; $ctj++) {
22184 if (isset($cells[$brow][$ctj]) && $cells[$brow][$ctj]) {
22185 if ($this->packTableData) {
22186 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($cells[$brow][$ctj][
'borderbin']);
22188 $bb = $cells[$brow][$ctj][
'border_details'][
'B'][
'w'];
22190 $maxbwbottom = max($maxbwbottom, $bb);
22194 if (!empty($tableheader)) {
22195 $maxbwtop = $table[
'max_cell_border_width'][
'T'];
22198 for ($ctj = 0; $ctj < $numcols; $ctj++) {
22199 if (isset($cells[$trow][$ctj]) && $cells[$trow][$ctj]) {
22200 if ($this->packTableData) {
22201 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($cells[$trow][$ctj][
'borderbin']);
22203 $bt = $cells[$trow][$ctj][
'border_details'][
'T'][
'w'];
22205 $maxbwtop = max($maxbwtop, $bt);
22209 } elseif ($this->simpleTables) {
22210 $maxbwtop = $table[
'simple'][
'border_details'][
'T'][
'w'];
22211 $maxbwbottom = $table[
'simple'][
'border_details'][
'B'][
'w'];
22213 $adv = $maxbwbottom / 2;
22219 if ($i > 0 && $this->table_rotate && $level == 1) {
22223 if ($this->tableClipPath) {
22224 $this->writer->write(
"Q");
22230 if ($table[
'borders_separate']) {
22231 $bx -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'border_spacing_H'] / 2);
22232 if ($tablestartpageno != $this->page) {
22233 $by += $table[
'max_cell_border_width'][
'T'] / 2;
22234 if (empty($tableheader)) {
22235 $by -= ($table[
'border_spacing_V'] / 2);
22238 $by -= ($table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'] + $table[
'border_spacing_V'] / 2);
22240 } elseif ($tablestartpageno != $this->page && !empty($tableheader)) {
22241 $by += $maxbwtop / 2;
22244 $by -= $tableheaderadj;
22245 $bh = $this->y - $by + $tablefooteradj;
22246 if (!$table[
'borders_separate']) {
22251 for ($t = $startcol; $t < $numcols; $t++) {
22252 if ($table[
'colPg'][$t] == $splitpg) {
22253 $bw += $table[
'wc'][$t];
22255 if ($table[
'colPg'][$t] > $splitpg) {
22259 if ($table[
'borders_separate']) {
22260 if ($firstSpread) {
22261 $bw += $table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'border_spacing_H'];
22263 $bx += ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w']);
22264 $bw += $table[
'border_spacing_H'];
22266 if ($finalSpread) {
22267 $bw += $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] / 2 + $table[
'border_spacing_H'];
22271 $bw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
22274 if ($this->splitTableBorderWidth && ($this->keepColumns || !$this->ColActive) && empty($tablefooter) && $i > 0 && $table[
'border_details'][
'B'][
'w']) {
22275 $prevDrawColor = $this->DrawColor;
22276 $lw = $this->LineWidth;
22278 $this->SetDColor($table[
'border_details'][
'B'][
'c']);
22279 $this->SetLineJoin(0);
22280 $this->SetLineCap(0);
22283 if (!$table[
'borders_separate']) {
22284 $blx -= ($table[
'max_cell_border_width'][
'L'] / 2);
22285 $blw += ($table[
'max_cell_border_width'][
'L'] / 2 + $table[
'max_cell_border_width'][
'R'] / 2);
22287 $this->Line($blx, $this->y + ($this->splitTableBorderWidth / 2), $blx + $blw, $this->y + ($this->splitTableBorderWidth / 2));
22288 $this->DrawColor = $prevDrawColor;
22289 $this->writer->write($this->DrawColor);
22291 $this->SetLineJoin(2);
22292 $this->SetLineCap(2);
22295 if (!$this->ColActive && ($i > 0 || $j > 0)) {
22296 if (isset($table[
'bgcolor'][-1])) {
22297 $color = $this->colorConverter->convert($table[
'bgcolor'][-1], $this->PDFAXwarnings);
22299 if (!$table[
'borders_separate']) {
22300 $bh -= $table[
'max_cell_border_width'][
'B'] / 2;
22302 $this->tableBackgrounds[$level * 9][] = [
'gradient' =>
false,
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'col' => $color];
22307 if (isset($table[
'gradient'])) {
22308 $g = $this->gradient->parseBackgroundGradient($table[
'gradient']);
22310 $this->tableBackgrounds[$level * 9 + 1][] = [
'gradient' =>
true,
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
22314 if (isset($table[
'background-image'])) {
22315 if ($table[
'background-image'][
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $table[
'background-image'][
'gradient'])) {
22316 $g = $this->gradient->parseMozGradient($table[
'background-image'][
'gradient']);
22318 $this->tableBackgrounds[$level * 9 + 1][] = [
'gradient' =>
true,
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
22321 $image_id = $table[
'background-image'][
'image_id'];
22322 $orig_w = $table[
'background-image'][
'orig_w'];
22323 $orig_h = $table[
'background-image'][
'orig_h'];
22324 $x_pos = $table[
'background-image'][
'x_pos'];
22325 $y_pos = $table[
'background-image'][
'y_pos'];
22326 $x_repeat = $table[
'background-image'][
'x_repeat'];
22327 $y_repeat = $table[
'background-image'][
'y_repeat'];
22328 $resize = $table[
'background-image'][
'resize'];
22329 $opacity = $table[
'background-image'][
'opacity'];
22330 $itype = $table[
'background-image'][
'itype'];
22331 $this->tableBackgrounds[$level * 9 + 2][] = [
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' =>
'',
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
22338 if ($this->tableBackgrounds) {
22339 $s = $this->PrintTableBackgrounds();
22340 if ($this->bufferoutput) {
22341 $this->headerbuffer = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->headerbuffer);
22342 $this->headerbuffer = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
" ", $this->headerbuffer);
22344 $this->pages[$this->page] = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->pages[$this->page]);
22345 $this->pages[$this->page] = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
" ", $this->pages[$this->page]);
22347 $this->tableBackgrounds = [];
22351 if ($i == 0 && $j == 0) {
22353 } elseif ($finalSpread) {
22362 return [
false, $startrow, $startcol, $splitpg, $returny, $y0];
22365 $this->
AddPage($this->CurOrientation);
22367 $this->writer->write(
'___TABLE___BACKGROUNDS' . $this->uniqstr);
22370 if ($this->tableClipPath) {
22371 $this->writer->write($this->tableClipPath);
22375 $x = $x + $this->MarginCorrection;
22376 $x0 = $x0 + $this->MarginCorrection;
22378 if ($this->splitTableBorderWidth && ($this->keepColumns || !$this->ColActive) && empty($tableheader) && $i > 0 && $table[
'border_details'][
'T'][
'w']) {
22379 $prevDrawColor = $this->DrawColor;
22380 $lw = $this->LineWidth;
22382 $this->SetDColor($table[
'border_details'][
'T'][
'c']);
22383 $this->SetLineJoin(0);
22384 $this->SetLineCap(0);
22385 $blx += $this->MarginCorrection;
22386 $this->Line($blx, $this->y - ($this->splitTableBorderWidth / 2), $blx + $blw, $this->y - ($this->splitTableBorderWidth / 2));
22387 $this->DrawColor = $prevDrawColor;
22388 $this->writer->write($this->DrawColor);
22390 $this->SetLineJoin(2);
22391 $this->SetLineCap(2);
22396 if ($i > 0 && !$this->table_rotate && $level == 1 && $table[
'headernrows'] == 0) {
22397 if ($table[
'borders_separate']) {
22398 $adv = $table[
'border_spacing_V'] / 2;
22401 for ($ctj = 0; $ctj < $numcols; $ctj++) {
22402 if (isset($cells[$i][$ctj]) && $cells[$i][$ctj]) {
22403 if (!$this->simpleTables) {
22404 if ($this->packTableData) {
22405 list($bt, $br, $bb, $bl) = $this->_getBorderWidths($cells[$i][$ctj][
'borderbin']);
22407 $bt = $cells[$i][$ctj][
'border_details'][
'T'][
'w'];
22409 $maxbwtop = max($maxbwtop, $bt);
22410 } elseif ($this->simpleTables) {
22411 $maxbwtop = max($maxbwtop, $table[
'simple'][
'border_details'][
'T'][
'w']);
22415 $adv = $maxbwtop / 2;
22421 if ($this->table_rotate) {
22422 $this->tbrot_x0 = $this->lMargin + $this->blk[$this->blklvl][
'outer_left_margin'] + $this->blk[$this->blklvl][
'padding_left'] + $this->blk[$this->blklvl][
'border_left'][
'w'];
22423 if ($table[
'borders_separate']) {
22424 $this->tbrot_h = $table[
'margin'][
'T'] + $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'] + $table[
'border_spacing_V'] / 2;
22426 $this->tbrot_h = $table[
'margin'][
'T'] + $table[
'max_cell_border_width'][
'T'];
22428 $this->tbrot_y0 = $this->y;
22429 $pagetrigger = $y0 - $tableheaderadj + ($this->blk[$this->blklvl][
'inner_width']);
22431 $pagetrigger = $this->PageBreakTrigger;
22434 if ($this->kwt_saved && $level == 1) {
22435 $this->kwt_moved =
true;
22439 if (!empty($tableheader)) {
22441 $this->TableHeaderFooter($tableheader, $tablestartpage, $tablestartcolumn,
'H', $level);
22442 if ($this->table_rotate) {
22443 $this->tbrot_h = $this->y - $ya;
22445 $tableheaderadj = $this->y - $ya;
22446 } elseif ($i == 0 && !$this->table_rotate && $level == 1 && !$this->ColActive) {
22448 if ($table[
'borders_separate']) {
22449 $adv = $table[
'border_spacing_V'] / 2 + $table[
'border_details'][
'T'][
'w'] + $table[
'padding'][
'T'];
22451 $adv = $table[
'max_cell_border_width'][
'T'] / 2;
22454 if ($this->table_rotate) {
22455 $this->y += ($adv);
22457 $this->DivLn($adv, $this->blklvl,
true);
22463 $y = $y0 = $this->y;
22469 if ($this->CurrCol != $oldcolumn) {
22471 $x += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
22472 $x0 += $this->ChangeColumn * ($this->ColWidth + $this->ColGap);
22473 if ($this->CurrCol == 0) {
22480 if ($this->CurrCol != 0 && ($this->keepColumns && $this->ColActive) && !empty($tableheader) && $i > 0) {
22483 $this->TableHeaderFooter($tableheader, $tablestartpage, $tablestartcolumn,
'H', $level);
22484 $y0 = $y = $this->y;
22495 if ($this->kwt_saved && $level == 1) {
22496 $this->printkwtbuffer();
22497 $x0 = $x = $this->x;
22498 $y0 = $y = $this->y;
22499 $this->kwt_moved =
false;
22500 $this->kwt_saved =
false;
22505 if ($i == 0 && $j == 0 && $level == 1) {
22506 if (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
22507 $tablestartpage =
'EVEN';
22508 } elseif (($this->mirrorMargins) && (($this->page) % 2 == 1)) {
22509 $tablestartpage =
'ODD';
22511 $tablestartpage =
'';
22513 $tablestartpageno = $this->page;
22514 if ($this->ColActive) {
22515 $tablestartcolumn = $this->CurrCol;
22520 $align = $cell[
'a'];
22524 if ($this->ColActive) {
22526 if ($this->blklvl > 0 && ($j == 0) && !$this->table_rotate && $level == 1) {
22527 $firstblockfill = $this->GetFirstBlockFill();
22528 if ($firstblockfill && $this->blklvl >= $firstblockfill) {
22529 $divh = $maxrowheight;
22531 if ((!isset($cell[
'rowspan']) && $i == $numrows - 1) || (isset($cell[
'rowspan']) && (($i == $numrows - 1 && $cell[
'rowspan'] < 2) || ($cell[
'rowspan'] > 1 && ($i + $cell[
'rowspan'] - 1) == $numrows - 1)))) {
22532 if ($table[
'borders_separate']) {
22533 $adv = $table[
'margin'][
'B'] + $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] / 2;
22535 $adv = $table[
'margin'][
'B'] + $table[
'max_cell_border_width'][
'B'] / 2;
22540 if (($this->y + $divh) > $outerfilled) {
22543 if ($outerfilled > $this->y) {
22544 $divh = ($this->y + $divh) - $outerfilled;
22545 $this->y = $outerfilled;
22548 $this->DivLn($divh, -3,
false);
22549 $outerfilled = $this->y + $divh;
22551 $bcor = $this->blk[$this->blklvl][
'bgcolorarray'];
22553 $this->SetFColor($bcor);
22563 if ($this->ColActive) {
22564 if ($table[
'borders_separate']) {
22565 $fill = isset($table[
'bgcolor'][-1]) ? $table[
'bgcolor'][-1] : 0;
22567 $color = $this->colorConverter->convert($fill, $this->PDFAXwarnings);
22569 $xadj = ($table[
'border_spacing_H'] / 2);
22570 $yadj = ($table[
'border_spacing_V'] / 2);
22571 $wadj = $table[
'border_spacing_H'];
22572 $hadj = $table[
'border_spacing_V'];
22574 $yadj += $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'];
22575 $hadj += $table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'];
22578 $xadj += $table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'];
22579 $wadj += $table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'];
22581 if ($i == ($numrows - 1) || (isset($cell[
'rowspan']) && ($i + $cell[
'rowspan']) == $numrows) || (!isset($cell[
'rowspan']) && ($i + 1) == $numrows)) {
22582 $hadj += $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'];
22584 if ($j == ($numcols - 1) || (isset($cell[
'colspan']) && ($j + $cell[
'colspan']) == $numcols) || (!isset($cell[
'colspan']) && ($j + 1) == $numcols)) {
22585 $wadj += $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'];
22587 $this->SetFColor($color);
22588 $this->Rect($x - $xadj, $y - $yadj, $w + $wadj, $h + $hadj,
'F');
22595 if ($table[
'empty_cells'] !=
'hide' || !empty($cell[
'textbuffer']) || (isset($cell[
'nestedcontent']) && $cell[
'nestedcontent']) || !$table[
'borders_separate']) {
22598 $paintcell =
false;
22605 if (!$this->simpleTables) {
22606 if ($this->packTableData) {
22607 $c = $this->_unpackCellBorder($cell[
'borderbin']);
22608 $bord = $c[
'border'];
22609 $bord_det = $c[
'border_details'];
22611 $bord = $cell[
'border'];
22612 $bord_det = $cell[
'border_details'];
22614 } elseif ($this->simpleTables) {
22615 $bord = $table[
'simple'][
'border'];
22616 $bord_det = $table[
'simple'][
'border_details'];
22621 if (isset($cell[
'bgcolor']) && $cell[
'bgcolor'] && $cell[
'bgcolor'] !=
'transparent') {
22622 $fill = $cell[
'bgcolor'];
22624 } elseif (isset($table[
'bgcolor'][$i]) && $table[
'bgcolor'][$i] && $table[
'bgcolor'][$i] !=
'transparent') {
22625 $fill = $table[
'bgcolor'][$i];
22628 if ($fill && $paintcell) {
22629 $color = $this->colorConverter->convert($fill, $this->PDFAXwarnings);
22631 if ($table[
'borders_separate']) {
22632 if ($this->ColActive) {
22633 $this->SetFColor($color);
22634 $this->Rect($x + ($table[
'border_spacing_H'] / 2), $y + ($table[
'border_spacing_V'] / 2), $w - $table[
'border_spacing_H'], $h - $table[
'border_spacing_V'],
'F');
22636 $this->tableBackgrounds[$level * 9 + $leveladj][] = [
'gradient' =>
false,
'x' => ($x + ($table[
'border_spacing_H'] / 2)),
'y' => ($y + ($table[
'border_spacing_V'] / 2)),
'w' => ($w - $table[
'border_spacing_H']),
'h' => ($h - $table[
'border_spacing_V']),
'col' => $color];
22639 if ($this->ColActive) {
22640 $this->SetFColor($color);
22641 $this->Rect($x, $y, $w, $h,
'F');
22643 $this->tableBackgrounds[$level * 9 + $leveladj][] = [
'gradient' =>
false,
'x' => $x,
'y' => $y,
'w' => $w,
'h' => $h,
'col' => $color];
22650 if (isset($cell[
'gradient']) && $cell[
'gradient'] && $paintcell) {
22651 $g = $this->gradient->parseBackgroundGradient($cell[
'gradient']);
22653 if ($table[
'borders_separate']) {
22654 $px = $x + ($table[
'border_spacing_H'] / 2);
22655 $py = $y + ($table[
'border_spacing_V'] / 2);
22656 $pw = $w - $table[
'border_spacing_H'];
22657 $ph = $h - $table[
'border_spacing_V'];
22664 if ($this->ColActive) {
22665 $this->gradient->Gradient($px, $py, $pw, $ph, $g[
'type'], $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend']);
22667 $this->tableBackgrounds[$level * 9 + 7][] = [
'gradient' =>
true,
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
22672 if (isset($cell[
'background-image']) && $paintcell) {
22673 if (isset($cell[
'background-image'][
'gradient']) && $cell[
'background-image'][
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $cell[
'background-image'][
'gradient'])) {
22674 $g = $this->gradient->parseMozGradient($cell[
'background-image'][
'gradient']);
22676 if ($table[
'borders_separate']) {
22677 $px = $x + ($table[
'border_spacing_H'] / 2);
22678 $py = $y + ($table[
'border_spacing_V'] / 2);
22679 $pw = $w - $table[
'border_spacing_H'];
22680 $ph = $h - $table[
'border_spacing_V'];
22687 if ($this->ColActive) {
22688 $this->gradient->Gradient($px, $py, $pw, $ph, $g[
'type'], $g[
'stops'], $g[
'colorspace'], $g[
'coords'], $g[
'extend']);
22690 $this->tableBackgrounds[$level * 9 + 7][] = [
'gradient' =>
true,
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
22693 } elseif (isset($cell[
'background-image'][
'image_id']) && $cell[
'background-image'][
'image_id']) {
22694 $n = count($this->patterns) + 1;
22695 if ($table[
'borders_separate']) {
22696 $px = $x + ($table[
'border_spacing_H'] / 2);
22697 $py = $y + ($table[
'border_spacing_V'] / 2);
22698 $pw = $w - $table[
'border_spacing_H'];
22699 $ph = $h - $table[
'border_spacing_V'];
22706 if ($this->ColActive) {
22707 list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($cell[
'background-image'][
'orig_w'], $cell[
'background-image'][
'orig_h'], $pw, $ph, $cell[
'background-image'][
'resize'], $cell[
'background-image'][
'x_repeat'], $cell[
'background-image'][
'y_repeat']);
22708 $this->patterns[$n] = [
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'pgh' => $this->h,
'image_id' => $cell[
'background-image'][
'image_id'],
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $cell[
'background-image'][
'x_pos'],
'y_pos' => $cell[
'background-image'][
'y_pos'],
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat];
22709 if ($cell[
'background-image'][
'opacity'] > 0 && $cell[
'background-image'][
'opacity'] < 1) {
22710 $opac = $this->SetAlpha($cell[
'background-image'][
'opacity'],
'Normal',
true);
22714 $this->writer->write(sprintf(
'q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, $px * Mpdf::SCALE, ($this->h - $py) * Mpdf::SCALE, $pw * Mpdf::SCALE, -$ph * Mpdf::SCALE));
22716 $image_id = $cell[
'background-image'][
'image_id'];
22717 $orig_w = $cell[
'background-image'][
'orig_w'];
22718 $orig_h = $cell[
'background-image'][
'orig_h'];
22719 $x_pos = $cell[
'background-image'][
'x_pos'];
22720 $y_pos = $cell[
'background-image'][
'y_pos'];
22721 $x_repeat = $cell[
'background-image'][
'x_repeat'];
22722 $y_repeat = $cell[
'background-image'][
'y_repeat'];
22723 $resize = $cell[
'background-image'][
'resize'];
22724 $opacity = $cell[
'background-image'][
'opacity'];
22725 $itype = $cell[
'background-image'][
'itype'];
22726 $this->tableBackgrounds[$level * 9 + 8][] = [
'x' => $px,
'y' => $py,
'w' => $pw,
'h' => $ph,
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' =>
'',
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
22732 if (isset($cell[
'colspan']) && $cell[
'colspan'] > 1) {
22733 $ccolsp = $cell[
'colspan'];
22737 if (isset($cell[
'rowspan']) && $cell[
'rowspan'] > 1) {
22738 $crowsp = $cell[
'rowspan'];
22745 if (!$table[
'borders_separate'] && $this->tabletheadjustfinished && !$this->simpleTables) {
22746 if (isset($table[
'topntail']) && $table[
'topntail']) {
22747 $bord_det[
'T'] = $this->border_details($table[
'topntail']);
22748 $bord_det[
'T'][
'w'] /= $this->shrin_k;
22751 if (isset($table[
'thead-underline']) && $table[
'thead-underline']) {
22752 $bord_det[
'T'] = $this->border_details($table[
'thead-underline']);
22753 $bord_det[
'T'][
'w'] /= $this->shrin_k;
22761 if (isset($table[
'is_thead'][$i]) && $table[
'is_thead'][$i] && $level == 1) {
22763 $tableheaderrowheight += $table[
'hr'][$i];
22765 $tableheader[$i][0][
'trbackground-images'] = (isset($table[
'trbackground-images'][$i]) ? $table[
'trbackground-images'][$i] :
null);
22766 $tableheader[$i][0][
'trgradients'] = (isset($table[
'trgradients'][$i]) ? $table[
'trgradients'][$i] :
null);
22767 $tableheader[$i][0][
'trbgcolor'] = (isset($table[
'bgcolor'][$i]) ? $table[
'bgcolor'][$i] :
null);
22768 $tableheader[$i][$j][
'x'] = $x;
22769 $tableheader[$i][$j][
'y'] = $y;
22770 $tableheader[$i][$j][
'h'] = $h;
22771 $tableheader[$i][$j][
'w'] = $w;
22772 if (isset($cell[
'textbuffer'])) {
22773 $tableheader[$i][$j][
'textbuffer'] = $cell[
'textbuffer'];
22775 $tableheader[$i][$j][
'textbuffer'] =
'';
22777 $tableheader[$i][$j][
'a'] = $cell[
'a'];
22778 $tableheader[$i][$j][
'R'] = $cell[
'R'];
22780 $tableheader[$i][$j][
'va'] = $cell[
'va'];
22781 $tableheader[$i][$j][
'mih'] = $cell[
'mih'];
22782 $tableheader[$i][$j][
'gradient'] = (isset($cell[
'gradient']) ? $cell[
'gradient'] :
null);
22783 $tableheader[$i][$j][
'background-image'] = (isset($cell[
'background-image']) ? $cell[
'background-image'] :
null);
22784 $tableheader[$i][$j][
'rowspan'] = (isset($cell[
'rowspan']) ? $cell[
'rowspan'] :
null);
22785 $tableheader[$i][$j][
'colspan'] = (isset($cell[
'colspan']) ? $cell[
'colspan'] :
null);
22786 $tableheader[$i][$j][
'bgcolor'] = $cell[
'bgcolor'];
22788 if (!$this->simpleTables) {
22789 $tableheader[$i][$j][
'border'] = $bord;
22790 $tableheader[$i][$j][
'border_details'] = $bord_det;
22791 } elseif ($this->simpleTables) {
22792 $tableheader[$i][$j][
'border'] = $table[
'simple'][
'border'];
22793 $tableheader[$i][$j][
'border_details'] = $table[
'simple'][
'border_details'];
22795 $tableheader[$i][$j][
'padding'] = $cell[
'padding'];
22796 if (isset($cell[
'direction'])) {
22797 $tableheader[$i][$j][
'direction'] = $cell[
'direction'];
22799 if (isset($cell[
'cellLineHeight'])) {
22800 $tableheader[$i][$j][
'cellLineHeight'] = $cell[
'cellLineHeight'];
22802 if (isset($cell[
'cellLineStackingStrategy'])) {
22803 $tableheader[$i][$j][
'cellLineStackingStrategy'] = $cell[
'cellLineStackingStrategy'];
22805 if (isset($cell[
'cellLineStackingShift'])) {
22806 $tableheader[$i][$j][
'cellLineStackingShift'] = $cell[
'cellLineStackingShift'];
22812 if ($table[
'borders_separate'] && $paintcell) {
22813 $this->_tableRect($x + ($table[
'border_spacing_H'] / 2) + ($bord_det[
'L'][
'w'] / 2), $y + ($table[
'border_spacing_V'] / 2) + ($bord_det[
'T'][
'w'] / 2), $w - $table[
'border_spacing_H'] - ($bord_det[
'L'][
'w'] / 2) - ($bord_det[
'R'][
'w'] / 2), $h - $table[
'border_spacing_V'] - ($bord_det[
'T'][
'w'] / 2) - ($bord_det[
'B'][
'w'] / 2), $bord, $bord_det,
false, $table[
'borders_separate']);
22814 } elseif (!$table[
'borders_separate']) {
22815 $this->_tableRect($x, $y, $w, $h, $bord, $bord_det,
true, $table[
'borders_separate']);
22820 if ($cell[
'R'] && intval($cell[
'R']) > 0 && intval($cell[
'R']) < 90 && isset($cell[
'va']) && $cell[
'va'] !=
'B') {
22823 if (!isset($cell[
'va']) || $cell[
'va'] ==
'M') {
22824 $this->y += ($h - $cell[
'mih']) / 2;
22825 } elseif (isset($cell[
'va']) && $cell[
'va'] ==
'B') {
22826 $this->y += $h - $cell[
'mih'];
22832 $this->divwidth = $w;
22833 if (!empty($cell[
'textbuffer'])) {
22834 $this->cellTextAlign = $align;
22835 $this->cellLineHeight = $cell[
'cellLineHeight'];
22836 $this->cellLineStackingStrategy = $cell[
'cellLineStackingStrategy'];
22837 $this->cellLineStackingShift = $cell[
'cellLineStackingShift'];
22839 if (isset($table[
'is_tfoot'][$i]) && $table[
'is_tfoot'][$i]) {
22840 if (preg_match(
'/{colsum([0-9]*)[_]*}/', $cell[
'textbuffer'][0][0], $m)) {
22841 $rep = sprintf(
"%01." . intval($m[1]) .
"f", $this->colsums[$j]);
22842 $cell[
'textbuffer'][0][0] = preg_replace(
'/{colsum[0-9_]*}/', $rep, $cell[
'textbuffer'][0][0]);
22844 } elseif (!isset($table[
'is_thead'][$i])) {
22845 if (isset($this->colsums[$j])) {
22846 $this->colsums[$j] += $this->toFloat($cell[
'textbuffer'][0][0]);
22848 $this->colsums[$j] = $this->toFloat($cell[
'textbuffer'][0][0]);
22854 if ($this->iterationCounter) {
22855 foreach ($cell[
'textbuffer'] as $k => $t) {
22856 if (preg_match(
'/{iteration ([a-zA-Z0-9_]+)}/', $t[0], $m)) {
22857 $vname =
'__' . $m[1] .
'_';
22858 if (!isset($this->$vname)) {
22863 $cell[
'textbuffer'][$k][0] = preg_replace(
'/{iteration ' . $m[1] .
'}/', $this->$vname, $cell[
'textbuffer'][$k][0]);
22870 $cellPtSize = $cell[
'textbuffer'][0][11] / $this->shrin_k;
22871 if (!$cellPtSize) {
22872 $cellPtSize = $this->default_font_size;
22874 $cellFontHeight = ($cellPtSize / Mpdf::SCALE);
22876 $angle = intval($cell[
'R']);
22880 } elseif ($angle > 0 && $angle < 45) {
22882 } elseif ($angle < 0) {
22885 $offset = ((sin(deg2rad($angle))) * 0.37 * $cellFontHeight);
22886 if (isset($cell[
'a']) && $cell[
'a'] ==
'R') {
22887 $this->x += ($w) + ($offset) - ($cellFontHeight / 3) - ($cell[
'padding'][
'R'] + ($table[
'border_spacing_H'] / 2));
22888 } elseif (!isset($cell[
'a']) || $cell[
'a'] ==
'C') {
22889 $this->x += ($w / 2) + ($offset);
22891 $this->x += ($offset) + ($cellFontHeight / 3) + ($cell[
'padding'][
'L'] + ($table[
'border_spacing_H'] / 2));
22894 foreach ($cell[
'textbuffer'] as $t) {
22895 $str .= $t[0] .
' ';
22897 $str = rtrim($str);
22898 if (!isset($cell[
'va']) || $cell[
'va'] ==
'M') {
22899 $this->y -= ($h - $cell[
'mih']) / 2;
22901 $this->y += (($h - $cell[
'mih']) / 2) + $cell[
'padding'][
'T'] + ($cell[
'mih'] - ($cell[
'padding'][
'T'] + $cell[
'padding'][
'B']));
22902 } elseif ($angle < 0) {
22903 $this->y += (($h - $cell[
'mih']) / 2) + ($cell[
'padding'][
'T'] + ($table[
'border_spacing_V'] / 2));
22905 } elseif (isset($cell[
'va']) && $cell[
'va'] ==
'B') {
22906 $this->y -= $h - $cell[
'mih'];
22908 $this->y += $h - ($cell[
'padding'][
'B'] + ($table[
'border_spacing_V'] / 2));
22909 } elseif ($angle < 0) {
22910 $this->y += $h - $cell[
'mih'] + ($cell[
'padding'][
'T'] + ($table[
'border_spacing_V'] / 2));
22912 } elseif (isset($cell[
'va']) && $cell[
'va'] ==
'T') {
22914 $this->y += $cell[
'mih'] - ($cell[
'padding'][
'B'] + ($table[
'border_spacing_V'] / 2));
22915 } elseif ($angle < 0) {
22916 $this->y += ($cell[
'padding'][
'T'] + ($table[
'border_spacing_V'] / 2));
22919 $this->Rotate($angle, $this->x, $this->y);
22920 $s_fs = $this->FontSizePt;
22921 $s_f = $this->FontFamily;
22922 $s_st = $this->FontStyle;
22923 if (!empty($cell[
'textbuffer'][0][3])) {
22924 $cor = $cell[
'textbuffer'][0][3];
22925 $this->SetTColor($cor);
22927 $this->
SetFont($cell[
'textbuffer'][0][4], $cell[
'textbuffer'][0][2], $cellPtSize,
true,
true);
22929 $this->magic_reverse_dir($str, $this->directionality, $cell[
'textbuffer'][0][18]);
22930 $this->Text($this->x, $this->y, $str, $cell[
'textbuffer'][0][18], $cell[
'textbuffer'][0][8]);
22932 $this->
SetFont($s_f, $s_st, $s_fs,
true,
true);
22933 $this->SetTColor(0);
22936 if (!$this->simpleTables) {
22938 $btlw = $bord_det[
'L'][
'w'];
22939 $btrw = $bord_det[
'R'][
'w'];
22940 $bttw = $bord_det[
'T'][
'w'];
22946 if ($table[
'borders_separate']) {
22947 $xadj = $btlw + $cell[
'padding'][
'L'] + ($table[
'border_spacing_H'] / 2);
22948 $wadj = $btlw + $btrw + $cell[
'padding'][
'L'] + $cell[
'padding'][
'R'] + $table[
'border_spacing_H'];
22949 $yadj = $bttw + $cell[
'padding'][
'T'] + ($table[
'border_spacing_H'] / 2);
22951 $xadj = $btlw / 2 + $cell[
'padding'][
'L'];
22952 $wadj = ($btlw + $btrw) / 2 + $cell[
'padding'][
'L'] + $cell[
'padding'][
'R'];
22953 $yadj = $bttw / 2 + $cell[
'padding'][
'T'];
22955 } elseif ($this->simpleTables) {
22956 if ($table[
'borders_separate']) {
22957 $xadj = $table[
'simple'][
'border_details'][
'L'][
'w'] + $cell[
'padding'][
'L'] + ($table[
'border_spacing_H'] / 2);
22958 $wadj = $table[
'simple'][
'border_details'][
'L'][
'w'] + $table[
'simple'][
'border_details'][
'R'][
'w'] + $cell[
'padding'][
'L'] + $cell[
'padding'][
'R'] + $table[
'border_spacing_H'];
22959 $yadj = $table[
'simple'][
'border_details'][
'T'][
'w'] + $cell[
'padding'][
'T'] + ($table[
'border_spacing_H'] / 2);
22961 $xadj = $table[
'simple'][
'border_details'][
'L'][
'w'] / 2 + $cell[
'padding'][
'L'];
22962 $wadj = ($table[
'simple'][
'border_details'][
'L'][
'w'] + $table[
'simple'][
'border_details'][
'R'][
'w']) / 2 + $cell[
'padding'][
'L'] + $cell[
'padding'][
'R'];
22963 $yadj = $table[
'simple'][
'border_details'][
'T'][
'w'] / 2 + $cell[
'padding'][
'T'];
22966 $this->decimal_offset = 0;
22967 if (substr($cell[
'a'], 0, 1) ==
'D') {
22968 if (isset($cell[
'colspan']) && $cell[
'colspan'] > 1) {
22969 $this->cellTextAlign = $c[
'a'] = substr($cell[
'a'], 2, 1);
22971 $smax = $table[
'decimal_align'][$j][
'maxs0'];
22972 $d_content = $table[
'decimal_align'][$j][
'maxs0'] + $table[
'decimal_align'][$j][
'maxs1'];
22973 $this->decimal_offset = $smax;
22974 $extra = ($w - $d_content - $wadj);
22976 if (substr($cell[
'a'], 2, 1) ==
'R') {
22977 $this->decimal_offset += $extra;
22978 } elseif (substr($cell[
'a'], 2, 1) ==
'C') {
22979 $this->decimal_offset += ($extra) / 2;
22984 $this->divwidth = $w - $wadj;
22985 if ($this->divwidth == 0) {
22986 $this->divwidth = 0.0001;
22990 $this->printbuffer($cell[
'textbuffer'],
'',
true,
false, $cell[
'direction']);
22996 if (!$this->ColActive) {
22997 if (isset($table[
'trgradients'][$i]) && ($j == 0 || $table[
'borders_separate'])) {
22998 $g = $this->gradient->parseBackgroundGradient($table[
'trgradients'][$i]);
23003 $gw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
23004 if ($table[
'borders_separate']) {
23005 $gw -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] + $table[
'border_spacing_H']);
23006 $clx = $x + ($table[
'border_spacing_H'] / 2);
23007 $cly = $y + ($table[
'border_spacing_V'] / 2);
23008 $clw = $w - $table[
'border_spacing_H'];
23009 $clh = $h - $table[
'border_spacing_V'];
23011 $s = $this->_setClippingPath($clx, $cly, $clw, $clh);
23012 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx + ($table[
'border_spacing_H'] / 2),
'y' => $gy + ($table[
'border_spacing_V'] / 2),
'w' => $gw - $table[
'border_spacing_V'],
'h' => $gh - $table[
'border_spacing_H'],
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' => $s];
23014 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx,
'y' => $gy,
'w' => $gw,
'h' => $gh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
23018 if (isset($table[
'trbackground-images'][$i]) && ($j == 0 || $table[
'borders_separate'])) {
23019 if (isset($table[
'trbackground-images'][$i][
'gradient']) && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $table[
'trbackground-images'][$i][
'gradient'])) {
23020 $g = $this->gradient->parseMozGradient($table[
'trbackground-images'][$i][
'gradient']);
23025 $gw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
23026 if ($table[
'borders_separate']) {
23027 $gw -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] + $table[
'border_spacing_H']);
23028 $clx = $x + ($table[
'border_spacing_H'] / 2);
23029 $cly = $y + ($table[
'border_spacing_V'] / 2);
23030 $clw = $w - $table[
'border_spacing_H'];
23031 $clh = $h - $table[
'border_spacing_V'];
23033 $s = $this->_setClippingPath($clx, $cly, $clw, $clh);
23034 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx + ($table[
'border_spacing_H'] / 2),
'y' => $gy + ($table[
'border_spacing_V'] / 2),
'w' => $gw - $table[
'border_spacing_V'],
'h' => $gh - $table[
'border_spacing_H'],
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' => $s];
23036 $this->tableBackgrounds[$level * 9 + 4][] = [
'gradient' =>
true,
'x' => $gx,
'y' => $gy,
'w' => $gw,
'h' => $gh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
23040 $image_id = $table[
'trbackground-images'][$i][
'image_id'];
23041 $orig_w = $table[
'trbackground-images'][$i][
'orig_w'];
23042 $orig_h = $table[
'trbackground-images'][$i][
'orig_h'];
23043 $x_pos = $table[
'trbackground-images'][$i][
'x_pos'];
23044 $y_pos = $table[
'trbackground-images'][$i][
'y_pos'];
23045 $x_repeat = $table[
'trbackground-images'][$i][
'x_repeat'];
23046 $y_repeat = $table[
'trbackground-images'][$i][
'y_repeat'];
23047 $resize = $table[
'trbackground-images'][$i][
'resize'];
23048 $opacity = $table[
'trbackground-images'][$i][
'opacity'];
23049 $itype = $table[
'trbackground-images'][$i][
'itype'];
23054 $gw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
23055 if ($table[
'borders_separate']) {
23056 $gw -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'] + $table[
'border_spacing_H']);
23057 $clx = $x + ($table[
'border_spacing_H'] / 2);
23058 $cly = $y + ($table[
'border_spacing_V'] / 2);
23059 $clw = $w - $table[
'border_spacing_H'];
23060 $clh = $h - $table[
'border_spacing_V'];
23062 $s = $this->_setClippingPath($clx, $cly, $clw, $clh);
23063 $this->tableBackgrounds[$level * 9 + 5][] = [
'x' => $gx + ($table[
'border_spacing_H'] / 2),
'y' => $gy + ($table[
'border_spacing_V'] / 2),
'w' => $gw - $table[
'border_spacing_V'],
'h' => $gh - $table[
'border_spacing_H'],
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' => $s,
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
23065 $this->tableBackgrounds[$level * 9 + 5][] = [
'x' => $gx,
'y' => $gy,
'w' => $gw,
'h' => $gh,
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' =>
'',
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
23074 if (($table[
'borders_separate'] || ($this->simpleTables && !$table[
'simple'][
'border'])) && $table[
'border']) {
23075 $halfspaceL = $table[
'padding'][
'L'] + ($table[
'border_spacing_H'] / 2);
23076 $halfspaceR = $table[
'padding'][
'R'] + ($table[
'border_spacing_H'] / 2);
23077 $halfspaceT = $table[
'padding'][
'T'] + ($table[
'border_spacing_V'] / 2);
23078 $halfspaceB = $table[
'padding'][
'B'] + ($table[
'border_spacing_V'] / 2);
23087 $tby -= $halfspaceT + ($table[
'border_details'][
'T'][
'w'] / 2);
23088 $tbh += $halfspaceT + ($table[
'border_details'][
'T'][
'w'] / 2);
23092 if ($i == ($numrows - 1) || (isset($cell[
'rowspan']) && ($i + $cell[
'rowspan']) == $numrows)) {
23093 $tbh += $halfspaceB + ($table[
'border_details'][
'B'][
'w'] / 2);
23098 $tbx -= $halfspaceL + ($table[
'border_details'][
'L'][
'w'] / 2);
23099 $tbw += $halfspaceL + ($table[
'border_details'][
'L'][
'w'] / 2);
23103 if ($j == ($numcols - 1) || (isset($cell[
'colspan']) && ($j + $cell[
'colspan']) == $numcols)) {
23104 $tbw += $halfspaceR + ($table[
'border_details'][
'R'][
'w'] / 2);
23108 $this->_tableRect($tbx, $tby, $tbw, $tbh, $tab_bord, $table[
'border_details'],
false, $table[
'borders_separate'],
'table', $corner, $table[
'border_spacing_V'], $table[
'border_spacing_H']);
23117 $newpagestarted =
false;
23118 $this->tabletheadjustfinished =
false;
23121 if ($this->ColActive) {
23122 if (!$this->table_keep_together && $i < $numrows - 1 && $level == 1) {
23123 $this->breakpoints[$this->CurrCol][] = $y + $h;
23125 if (count($this->cellBorderBuffer)) {
23126 $this->printcellbuffer();
23131 if ($i == $numrows - 1) {
23132 $this->y = $y + $h;
23134 if ($this->table_rotate && $level == 1) {
23135 $this->tbrot_h += $h;
23139 if (count($this->cellBorderBuffer)) {
23140 $this->printcellbuffer();
23144 if ($this->tableClipPath) {
23145 $this->writer->write(
"Q");
23147 $this->tableClipPath =
'';
23150 if ($table[
'borders_separate']) {
23151 $this->y += $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] / 2;
23153 $this->y += $table[
'max_cell_border_width'][
'B'] / 2;
23156 if ($table[
'borders_separate'] && $level == 1) {
23157 $this->tbrot_h += $table[
'margin'][
'B'] + $table[
'padding'][
'B'] + $table[
'border_details'][
'B'][
'w'] + $table[
'border_spacing_V'] / 2;
23158 } elseif ($level == 1) {
23159 $this->tbrot_h += $table[
'margin'][
'B'] + $table[
'max_cell_border_width'][
'B'] / 2;
23164 if ($table[
'borders_separate']) {
23165 $bx -= ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'] + $table[
'border_spacing_H'] / 2);
23166 if ($tablestartpageno != $this->page) {
23167 $by += $table[
'max_cell_border_width'][
'T'] / 2;
23168 if (empty($tableheader)) {
23169 $by -= ($table[
'border_spacing_V'] / 2);
23171 } elseif ($split && $startrow > 0 && empty($tableheader)) {
23172 $by -= ($table[
'border_spacing_V'] / 2);
23174 $by -= ($table[
'padding'][
'T'] + $table[
'border_details'][
'T'][
'w'] + $table[
'border_spacing_V'] / 2);
23176 } elseif ($tablestartpageno != $this->page && !empty($tableheader)) {
23177 $by += $maxbwtop / 2;
23179 $by -= $tableheaderadj;
23180 $bh = $this->y - $by;
23181 if (!$table[
'borders_separate']) {
23182 $bh -= $table[
'max_cell_border_width'][
'B'] / 2;
23187 $finalSpread =
true;
23188 for ($t = $startcol; $t < $numcols; $t++) {
23189 if ($table[
'colPg'][$t] == $splitpg) {
23190 $bw += $table[
'wc'][$t];
23192 if ($table[
'colPg'][$t] > $splitpg) {
23193 $finalSpread =
false;
23197 if ($startcol == 0) {
23198 $firstSpread =
true;
23200 $firstSpread =
false;
23202 if ($table[
'borders_separate']) {
23203 $bw += $table[
'border_spacing_H'];
23204 if ($firstSpread) {
23205 $bw += $table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w'];
23207 $bx += ($table[
'padding'][
'L'] + $table[
'border_details'][
'L'][
'w']);
23209 if ($finalSpread) {
23210 $bw += $table[
'padding'][
'R'] + $table[
'border_details'][
'R'][
'w'];
23214 $bw = $table[
'w'] - ($table[
'max_cell_border_width'][
'L'] / 2) - ($table[
'max_cell_border_width'][
'R'] / 2) - $table[
'margin'][
'L'] - $table[
'margin'][
'R'];
23217 if (!$this->ColActive) {
23218 if (isset($table[
'bgcolor'][-1])) {
23219 $color = $this->colorConverter->convert($table[
'bgcolor'][-1], $this->PDFAXwarnings);
23221 $this->tableBackgrounds[$level * 9][] = [
'gradient' =>
false,
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'col' => $color];
23226 if (isset($table[
'gradient'])) {
23227 $g = $this->gradient->parseBackgroundGradient($table[
'gradient']);
23229 $this->tableBackgrounds[$level * 9 + 1][] = [
'gradient' =>
true,
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
23233 if (isset($table[
'background-image'])) {
23234 if (isset($table[
'background-image'][
'gradient']) && $table[
'background-image'][
'gradient'] && preg_match(
'/(-moz-)*(repeating-)*(linear|radial)-gradient/', $table[
'background-image'][
'gradient'])) {
23235 $g = $this->gradient->parseMozGradient($table[
'background-image'][
'gradient']);
23237 $this->tableBackgrounds[$level * 9 + 1][] = [
'gradient' =>
true,
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'gradtype' => $g[
'type'],
'stops' => $g[
'stops'],
'colorspace' => $g[
'colorspace'],
'coords' => $g[
'coords'],
'extend' => $g[
'extend'],
'clippath' =>
''];
23240 $image_id = $table[
'background-image'][
'image_id'];
23241 $orig_w = $table[
'background-image'][
'orig_w'];
23242 $orig_h = $table[
'background-image'][
'orig_h'];
23243 $x_pos = $table[
'background-image'][
'x_pos'];
23244 $y_pos = $table[
'background-image'][
'y_pos'];
23245 $x_repeat = $table[
'background-image'][
'x_repeat'];
23246 $y_repeat = $table[
'background-image'][
'y_repeat'];
23247 $resize = $table[
'background-image'][
'resize'];
23248 $opacity = $table[
'background-image'][
'opacity'];
23249 $itype = $table[
'background-image'][
'itype'];
23250 $this->tableBackgrounds[$level * 9 + 2][] = [
'x' => $bx,
'y' => $by,
'w' => $bw,
'h' => $bh,
'image_id' => $image_id,
'orig_w' => $orig_w,
'orig_h' => $orig_h,
'x_pos' => $x_pos,
'y_pos' => $y_pos,
'x_repeat' => $x_repeat,
'y_repeat' => $y_repeat,
'clippath' =>
'',
'resize' => $resize,
'opacity' => $opacity,
'itype' => $itype];
23256 if ($this->tableBackgrounds && $level == 1) {
23257 $s = $this->PrintTableBackgrounds();
23258 if ($this->table_rotate && !$this->processingHeader && !$this->processingFooter) {
23259 $this->tablebuffer = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->tablebuffer);
23261 $this->tablebuffer = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
" ", $this->tablebuffer);
23263 } elseif ($this->bufferoutput) {
23264 $this->headerbuffer = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->headerbuffer);
23266 $this->headerbuffer = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
" ", $this->headerbuffer);
23269 $this->pages[$this->page] = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
'\\1' .
"\n" . $s .
"\n", $this->pages[$this->page]);
23271 $this->pages[$this->page] = preg_replace(
'/(___TABLE___BACKGROUNDS' . $this->uniqstr .
')/',
" ", $this->pages[$this->page]);
23274 $this->tableBackgrounds = [];
23279 if ($table[
'margin'][
'B']) {
23280 if (!$this->table_rotate && $level == 1) {
23281 $this->DivLn($table[
'margin'][
'B'], $this->blklvl,
true);
23283 $this->y += ($table[
'margin'][
'B']);
23287 if ($this->ColActive && $level == 1) {
23288 $this->breakpoints[$this->CurrCol][] = $this->y;
23293 if ($lastCol < $numcols - 1) {
23295 $startcol = $lastCol + 1;
23296 return [
false, $startrow, $startcol, $splitpg, $returny, $y0];
23298 return [
true, 0, 0, 0,
false,
false];
23309 for ($i = 1; $i <= count($this->extgstates); $i++) {
23310 $this->writer->object();
23311 $this->extgstates[$i][
'n'] = $this->n;
23312 $this->writer->write(
'<</Type /ExtGState');
23313 foreach ($this->extgstates[$i][
'parms'] as $k => $v) {
23314 $this->writer->write(
'/' . $k .
' ' . $v);
23316 $this->writer->write(
'>>');
23317 $this->writer->write(
'endobj');
23321 function SetProtection($permissions = [], $user_pass =
'', $owner_pass =
null, $length = 40)
23323 $this->encrypted = $this->protection->setProtection($permissions, $user_pass, $owner_pass, $length);
23330 $txt = $this->purify_utf8_text($txt);
23331 if ($this->text_input_as_HTML) {
23332 $txt = $this->all_entities_to_utf8($txt);
23335 if (!$this->ColActive) {
23344 $bmo = [
't' => $txt,
'l' => $level,
'y' => $y,
'p' => $this->page];
23346 if ($this->keep_block_together) {
23348 } elseif ($this->table_rotate) {
23349 $this->tbrot_BMoutlines[] = $bmo;
23350 } elseif ($this->kwt) {
23351 $this->kwt_BMoutlines[] = $bmo;
23352 } elseif ($this->ColActive) {
23353 $this->col_BMoutlines[] = $bmo;
23355 $this->BMoutlines[] = $bmo;
23366 $resetpagenum =
'',
23367 $pagenumstyle =
'',
23369 $toc_orientation =
'',
23370 $TOCusePaging =
true,
23371 $TOCuseLinking =
false,
23376 $this->tableOfContents->TOC(
23393 if (!is_array($a)) {
23396 $tocoutdent = (isset($a[
'tocoutdent']) ? $a[
'tocoutdent'] : (isset($a[
'outdent']) ? $a[
'outdent'] :
''));
23397 $TOCusePaging = (isset($a[
'TOCusePaging']) ? $a[
'TOCusePaging'] : (isset($a[
'paging']) ? $a[
'paging'] :
true));
23398 $TOCuseLinking = (isset($a[
'TOCuseLinking']) ? $a[
'TOCuseLinking'] : (isset($a[
'links']) ? $a[
'links'] :
''));
23399 $toc_orientation = (isset($a[
'toc_orientation']) ? $a[
'toc_orientation'] : (isset($a[
'toc-orientation']) ? $a[
'toc-orientation'] :
''));
23400 $toc_mgl = (isset($a[
'toc_mgl']) ? $a[
'toc_mgl'] : (isset($a[
'toc-margin-left']) ? $a[
'toc-margin-left'] :
''));
23401 $toc_mgr = (isset($a[
'toc_mgr']) ? $a[
'toc_mgr'] : (isset($a[
'toc-margin-right']) ? $a[
'toc-margin-right'] :
''));
23402 $toc_mgt = (isset($a[
'toc_mgt']) ? $a[
'toc_mgt'] : (isset($a[
'toc-margin-top']) ? $a[
'toc-margin-top'] :
''));
23403 $toc_mgb = (isset($a[
'toc_mgb']) ? $a[
'toc_mgb'] : (isset($a[
'toc-margin-bottom']) ? $a[
'toc-margin-bottom'] :
''));
23404 $toc_mgh = (isset($a[
'toc_mgh']) ? $a[
'toc_mgh'] : (isset($a[
'toc-margin-header']) ? $a[
'toc-margin-header'] :
''));
23405 $toc_mgf = (isset($a[
'toc_mgf']) ? $a[
'toc_mgf'] : (isset($a[
'toc-margin-footer']) ? $a[
'toc-margin-footer'] :
''));
23406 $toc_ohname = (isset($a[
'toc_ohname']) ? $a[
'toc_ohname'] : (isset($a[
'toc-odd-header-name']) ? $a[
'toc-odd-header-name'] :
''));
23407 $toc_ehname = (isset($a[
'toc_ehname']) ? $a[
'toc_ehname'] : (isset($a[
'toc-even-header-name']) ? $a[
'toc-even-header-name'] :
''));
23408 $toc_ofname = (isset($a[
'toc_ofname']) ? $a[
'toc_ofname'] : (isset($a[
'toc-odd-footer-name']) ? $a[
'toc-odd-footer-name'] :
''));
23409 $toc_efname = (isset($a[
'toc_efname']) ? $a[
'toc_efname'] : (isset($a[
'toc-even-footer-name']) ? $a[
'toc-even-footer-name'] :
''));
23410 $toc_ohvalue = (isset($a[
'toc_ohvalue']) ? $a[
'toc_ohvalue'] : (isset($a[
'toc-odd-header-value']) ? $a[
'toc-odd-header-value'] : 0));
23411 $toc_ehvalue = (isset($a[
'toc_ehvalue']) ? $a[
'toc_ehvalue'] : (isset($a[
'toc-even-header-value']) ? $a[
'toc-even-header-value'] : 0));
23412 $toc_ofvalue = (isset($a[
'toc_ofvalue']) ? $a[
'toc_ofvalue'] : (isset($a[
'toc-odd-footer-value']) ? $a[
'toc-odd-footer-value'] : 0));
23413 $toc_efvalue = (isset($a[
'toc_efvalue']) ? $a[
'toc_efvalue'] : (isset($a[
'toc-even-footer-value']) ? $a[
'toc-even-footer-value'] : 0));
23414 $toc_preHTML = (isset($a[
'toc_preHTML']) ? $a[
'toc_preHTML'] : (isset($a[
'toc-preHTML']) ? $a[
'toc-preHTML'] :
''));
23415 $toc_postHTML = (isset($a[
'toc_postHTML']) ? $a[
'toc_postHTML'] : (isset($a[
'toc-postHTML']) ? $a[
'toc-postHTML'] :
''));
23416 $toc_bookmarkText = (isset($a[
'toc_bookmarkText']) ? $a[
'toc_bookmarkText'] : (isset($a[
'toc-bookmarkText']) ? $a[
'toc-bookmarkText'] :
''));
23417 $resetpagenum = (isset($a[
'resetpagenum']) ? $a[
'resetpagenum'] :
'');
23418 $pagenumstyle = (isset($a[
'pagenumstyle']) ? $a[
'pagenumstyle'] :
'');
23419 $suppress = (isset($a[
'suppress']) ? $a[
'suppress'] :
'');
23420 $orientation = (isset($a[
'orientation']) ? $a[
'orientation'] :
'');
23421 $mgl = (isset($a[
'mgl']) ? $a[
'mgl'] : (isset($a[
'margin-left']) ? $a[
'margin-left'] :
''));
23422 $mgr = (isset($a[
'mgr']) ? $a[
'mgr'] : (isset($a[
'margin-right']) ? $a[
'margin-right'] :
''));
23423 $mgt = (isset($a[
'mgt']) ? $a[
'mgt'] : (isset($a[
'margin-top']) ? $a[
'margin-top'] :
''));
23424 $mgb = (isset($a[
'mgb']) ? $a[
'mgb'] : (isset($a[
'margin-bottom']) ? $a[
'margin-bottom'] :
''));
23425 $mgh = (isset($a[
'mgh']) ? $a[
'mgh'] : (isset($a[
'margin-header']) ? $a[
'margin-header'] :
''));
23426 $mgf = (isset($a[
'mgf']) ? $a[
'mgf'] : (isset($a[
'margin-footer']) ? $a[
'margin-footer'] :
''));
23427 $ohname = (isset($a[
'ohname']) ? $a[
'ohname'] : (isset($a[
'odd-header-name']) ? $a[
'odd-header-name'] :
''));
23428 $ehname = (isset($a[
'ehname']) ? $a[
'ehname'] : (isset($a[
'even-header-name']) ? $a[
'even-header-name'] :
''));
23429 $ofname = (isset($a[
'ofname']) ? $a[
'ofname'] : (isset($a[
'odd-footer-name']) ? $a[
'odd-footer-name'] :
''));
23430 $efname = (isset($a[
'efname']) ? $a[
'efname'] : (isset($a[
'even-footer-name']) ? $a[
'even-footer-name'] :
''));
23431 $ohvalue = (isset($a[
'ohvalue']) ? $a[
'ohvalue'] : (isset($a[
'odd-header-value']) ? $a[
'odd-header-value'] : 0));
23432 $ehvalue = (isset($a[
'ehvalue']) ? $a[
'ehvalue'] : (isset($a[
'even-header-value']) ? $a[
'even-header-value'] : 0));
23433 $ofvalue = (isset($a[
'ofvalue']) ? $a[
'ofvalue'] : (isset($a[
'odd-footer-value']) ? $a[
'odd-footer-value'] : 0));
23434 $efvalue = (isset($a[
'efvalue']) ? $a[
'efvalue'] : (isset($a[
'even-footer-value']) ? $a[
'even-footer-value'] : 0));
23435 $toc_id = (isset($a[
'toc_id']) ? $a[
'toc_id'] : (isset($a[
'name']) ? $a[
'name'] : 0));
23436 $pagesel = (isset($a[
'pagesel']) ? $a[
'pagesel'] : (isset($a[
'pageselector']) ? $a[
'pageselector'] :
''));
23437 $toc_pagesel = (isset($a[
'toc_pagesel']) ? $a[
'toc_pagesel'] : (isset($a[
'toc-pageselector']) ? $a[
'toc-pageselector'] :
''));
23438 $sheetsize = (isset($a[
'sheetsize']) ? $a[
'sheetsize'] : (isset($a[
'sheet-size']) ? $a[
'sheet-size'] :
''));
23439 $toc_sheetsize = (isset($a[
'toc_sheetsize']) ? $a[
'toc_sheetsize'] : (isset($a[
'toc-sheet-size']) ? $a[
'toc-sheet-size'] :
''));
23441 $this->TOCpagebreak(
'',
'',
'', $TOCusePaging, $TOCuseLinking, $toc_orientation, $toc_mgl, $toc_mgr, $toc_mgt, $toc_mgb, $toc_mgh, $toc_mgf, $toc_ohname, $toc_ehname, $toc_ofname, $toc_efname, $toc_ohvalue, $toc_ehvalue, $toc_ofvalue, $toc_efvalue, $toc_preHTML, $toc_postHTML, $toc_bookmarkText, $resetpagenum, $pagenumstyle, $suppress, $orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $toc_id, $pagesel, $toc_pagesel, $sheetsize, $toc_sheetsize, $tocoutdent);
23444 function TOCpagebreak($tocfont =
'', $tocfontsize =
'', $tocindent =
'', $TOCusePaging =
true, $TOCuseLinking =
'', $toc_orientation =
'', $toc_mgl =
'', $toc_mgr =
'', $toc_mgt =
'', $toc_mgb =
'', $toc_mgh =
'', $toc_mgf =
'', $toc_ohname =
'', $toc_ehname =
'', $toc_ofname =
'', $toc_efname =
'', $toc_ohvalue = 0, $toc_ehvalue = 0, $toc_ofvalue = 0, $toc_efvalue = 0, $toc_preHTML =
'', $toc_postHTML =
'', $toc_bookmarkText =
'', $resetpagenum =
'', $pagenumstyle =
'', $suppress =
'', $orientation =
'', $mgl =
'', $mgr =
'', $mgt =
'', $mgb =
'', $mgh =
'', $mgf =
'', $ohname =
'', $ehname =
'', $ofname =
'', $efname =
'', $ohvalue = 0, $ehvalue = 0, $ofvalue = 0, $efvalue = 0, $toc_id = 0, $pagesel =
'', $toc_pagesel =
'', $sheetsize =
'', $toc_sheetsize =
'', $tocoutdent =
'')
23447 if ($this->state == 0) {
23450 if ($this->y == $this->tMargin && (!$this->mirrorMargins || ($this->mirrorMargins && $this->page % 2 == 1))) {
23452 if ($this->page == 1 && count($this->PageNumSubstitutions) == 0) {
23458 $this->PageNumSubstitutions[] = [
'from' => $this->page,
'reset' => $resetpagenum,
'type' => $pagenumstyle,
'suppress' => $suppress];
23460 $this->
AddPage($orientation,
'NEXT-ODD', $resetpagenum, $pagenumstyle, $suppress, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $pagesel, $sheetsize);
23462 $this->tableOfContents->TOCpagebreak($tocfont, $tocfontsize, $tocindent, $TOCusePaging, $TOCuseLinking, $toc_orientation, $toc_mgl, $toc_mgr, $toc_mgt, $toc_mgb, $toc_mgh, $toc_mgf, $toc_ohname, $toc_ehname, $toc_ofname, $toc_efname, $toc_ohvalue, $toc_ehvalue, $toc_ofvalue, $toc_efvalue, $toc_preHTML, $toc_postHTML, $toc_bookmarkText, $resetpagenum, $pagenumstyle, $suppress, $orientation, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $ohname, $ehname, $ofname, $efname, $ohvalue, $ehvalue, $ofvalue, $efvalue, $toc_id, $pagesel, $toc_pagesel, $sheetsize, $toc_sheetsize, $tocoutdent);
23467 if ($this->ColActive) {
23473 $linkn = $this->AddLink();
23474 $uid =
'__mpdfinternallink_' . $linkn;
23475 if ($this->table_rotate) {
23476 $this->internallink[$uid] = [
"Y" => $ily,
"PAGE" => $this->page,
"tbrot" =>
true];
23477 } elseif ($this->kwt) {
23478 $this->internallink[$uid] = [
"Y" => $ily,
"PAGE" => $this->page,
"kwt" =>
true];
23479 } elseif ($this->ColActive) {
23480 $this->internallink[$uid] = [
"Y" => $ily,
"PAGE" => $this->page,
"col" => $this->CurrCol];
23481 } elseif (!$this->keep_block_together) {
23482 $this->internallink[$uid] = [
"Y" => $ily,
"PAGE" => $this->page];
23484 $this->internallink[
'#' . $uid] = $linkn;
23485 $this->
SetLink($linkn, $ily, $this->page);
23487 if (strtoupper($toc_id) ==
'ALL') {
23488 $toc_id =
'_mpdf_all';
23489 } elseif (!$toc_id) {
23492 $toc_id = strtolower($toc_id);
23494 $btoc = [
't' => $txt,
'l' => $level,
'p' => $this->page,
'link' => $linkn,
'toc_id' => $toc_id];
23495 if ($this->keep_block_together) {
23497 } elseif ($this->table_rotate) {
23498 $this->tbrot_toc[] = $btoc;
23499 } elseif ($this->kwt) {
23500 $this->kwt_toc[] = $btoc;
23501 } elseif ($this->ColActive) {
23502 $this->col_toc[] = $btoc;
23505 $this->tableOfContents->_toc[] = $btoc;
23515 if ($end_page < 1) {
23516 $end_page = $start_page;
23518 $n_toc = $end_page - $start_page + 1;
23521 if (count($this->PageNumSubstitutions)) {
23522 $tp_present =
false;
23523 $sp_present =
false;
23524 $ep_present =
false;
23525 foreach ($this->PageNumSubstitutions as $k => $v) {
23526 if ($this->PageNumSubstitutions[$k][
'from'] == $target_page) {
23527 $tp_present =
true;
23528 if ($this->PageNumSubstitutions[$k][
'suppress'] !=
'on' && $this->PageNumSubstitutions[$k][
'suppress'] != 1) {
23529 $this->PageNumSubstitutions[$k][
'suppress'] =
'off';
23532 if ($this->PageNumSubstitutions[$k][
'from'] == $start_page) {
23533 $sp_present =
true;
23534 if ($this->PageNumSubstitutions[$k][
'suppress'] !=
'on' && $this->PageNumSubstitutions[$k][
'suppress'] != 1) {
23535 $this->PageNumSubstitutions[$k][
'suppress'] =
'off';
23538 if ($this->PageNumSubstitutions[$k][
'from'] == ($end_page + 1)) {
23539 $ep_present =
true;
23540 if ($this->PageNumSubstitutions[$k][
'suppress'] !=
'on' && $this->PageNumSubstitutions[$k][
'suppress'] != 1) {
23541 $this->PageNumSubstitutions[$k][
'suppress'] =
'off';
23546 if (!$tp_present) {
23547 list($tp_type, $tp_suppress, $tp_reset) = $this->docPageSettings($target_page);
23549 if (!$sp_present) {
23550 list($sp_type, $sp_suppress, $sp_reset) = $this->docPageSettings($start_page);
23552 if (!$ep_present) {
23553 list($ep_type, $ep_suppress, $ep_reset) = $this->docPageSettings($start_page - 1);
23559 for ($i = $start_page; $i <= $end_page; $i++) {
23560 $last[] = $this->pages[$i];
23563 for ($i = $start_page - 1; $i >= ($target_page); $i--) {
23564 $this->pages[$i + $n_toc] = $this->pages[$i];
23567 for ($i = 0; $i < $n_toc; $i++) {
23568 $this->pages[$target_page + $i] = $last[$i];
23573 foreach ($this->BMoutlines as $i => $o) {
23574 if ($o[
'p'] >= $target_page) {
23575 $this->BMoutlines[$i][
'p'] += $n_toc;
23581 if (count($this->PageLinks)) {
23583 foreach ($this->PageLinks as $i => $o) {
23584 foreach ($this->PageLinks[$i] as $key => $pl) {
23585 if (strpos($pl[4],
'@') === 0) {
23586 $p = substr($pl[4], 1);
23587 if ($p >= $start_page && $p <= $end_page) {
23588 $this->PageLinks[$i][$key][4] =
'@' . ($p + ($target_page - $start_page));
23589 } elseif ($p >= $target_page && $p < $start_page) {
23590 $this->PageLinks[$i][$key][4] =
'@' . ($p + $n_toc);
23594 if ($i >= $start_page && $i <= $end_page) {
23595 $newarr[($i + ($target_page - $start_page))] = $this->PageLinks[$i];
23596 } elseif ($i >= $target_page && $i < $start_page) {
23597 $newarr[($i + $n_toc)] = $this->PageLinks[$i];
23599 $newarr[$i] = $this->PageLinks[$i];
23602 $this->PageLinks = $newarr;
23606 if (count($this->OrientationChanges)) {
23608 foreach ($this->OrientationChanges as $p => $v) {
23609 if ($p >= $start_page && $p <= $end_page) {
23610 $newarr[($p + ($target_page - $start_page))] = $this->OrientationChanges[$p];
23611 } elseif ($p >= $target_page && $p < $start_page) {
23612 $newarr[$p + $n_toc] = $this->OrientationChanges[$p];
23614 $newarr[$p] = $this->OrientationChanges[$p];
23618 $this->OrientationChanges = $newarr;
23622 if (count($this->pageDim)) {
23624 foreach ($this->pageDim as $p => $v) {
23625 if ($p >= $start_page && $p <= $end_page) {
23626 $newarr[($p + ($target_page - $start_page))] = $this->pageDim[$p];
23627 } elseif ($p >= $target_page && $p < $start_page) {
23628 $newarr[$p + $n_toc] = $this->pageDim[$p];
23630 $newarr[$p] = $this->pageDim[$p];
23634 $this->pageDim = $newarr;
23638 if (count($this->saveHTMLHeader)) {
23640 foreach ($this->saveHTMLHeader as $p => $v) {
23641 if ($p >= $start_page && $p <= $end_page) {
23642 $newarr[($p + ($target_page - $start_page))] = $this->saveHTMLHeader[$p];
23643 } elseif ($p >= $target_page && $p < $start_page) {
23644 $newarr[$p + $n_toc] = $this->saveHTMLHeader[$p];
23646 $newarr[$p] = $this->saveHTMLHeader[$p];
23650 $this->saveHTMLHeader = $newarr;
23652 if (count($this->saveHTMLFooter)) {
23654 foreach ($this->saveHTMLFooter as $p => $v) {
23655 if ($p >= $start_page && $p <= $end_page) {
23656 $newarr[($p + ($target_page - $start_page))] = $this->saveHTMLFooter[$p];
23657 } elseif ($p >= $target_page && $p < $start_page) {
23658 $newarr[$p + $n_toc] = $this->saveHTMLFooter[$p];
23660 $newarr[$p] = $this->saveHTMLFooter[$p];
23664 $this->saveHTMLFooter = $newarr;
23668 if (count($this->internallink)) {
23669 foreach ($this->internallink as $key => $o) {
23670 if (is_array($o) && $o[
'PAGE'] >= $start_page && $o[
'PAGE'] <= $end_page) {
23671 $this->internallink[$key][
'PAGE'] += ($target_page - $start_page);
23672 } elseif (is_array($o) && $o[
'PAGE'] >= $target_page && $o[
'PAGE'] < $start_page) {
23673 $this->internallink[$key][
'PAGE'] += $n_toc;
23679 if (count($this->links)) {
23680 foreach ($this->links as $key => $o) {
23681 if ($o[0] >= $start_page && $o[0] <= $end_page) {
23682 $this->links[$key][0] += ($target_page - $start_page);
23684 if ($o[0] >= $target_page && $o[0] < $start_page) {
23685 $this->links[$key][0] += $n_toc;
23691 if (count($this->form->forms)) {
23692 foreach ($this->form->forms as $key => $f) {
23693 if ($f[
'page'] >= $start_page && $f[
'page'] <= $end_page) {
23694 $this->form->forms[$key][
'page'] += ($target_page - $start_page);
23696 if ($f[
'page'] >= $target_page && $f[
'page'] < $start_page) {
23697 $this->form->forms[$key][
'page'] += $n_toc;
23704 if (count($this->PageAnnots)) {
23706 foreach ($this->PageAnnots as $p => $anno) {
23707 if ($p >= $start_page && $p <= $end_page) {
23708 $np = $p + ($target_page - $start_page);
23709 foreach ($anno as $o) {
23710 $newarr[$np][] = $o;
23712 } elseif ($p >= $target_page && $p < $start_page) {
23714 foreach ($anno as $o) {
23715 $newarr[$np][] = $o;
23718 $newarr[$p] = $this->PageAnnots[$p];
23721 $this->PageAnnots = $newarr;
23727 if (count($this->tableOfContents->_toc)) {
23728 foreach ($this->tableOfContents->_toc as $key => $t) {
23729 if ($t[
'p'] >= $start_page && $t[
'p'] <= $end_page) {
23730 $this->tableOfContents->_toc[$key][
'p'] += ($target_page - $start_page);
23732 if ($t[
'p'] >= $target_page && $t[
'p'] < $start_page) {
23733 $this->tableOfContents->_toc[$key][
'p'] += $n_toc;
23739 if (count($this->PageNumSubstitutions)) {
23741 foreach ($this->PageNumSubstitutions as $k => $v) {
23742 if ($this->PageNumSubstitutions[$k][
'from'] >= $start_page && $this->PageNumSubstitutions[$k][
'from'] <= $end_page) {
23743 $this->PageNumSubstitutions[$k][
'from'] += ($target_page - $start_page);
23744 $newarr[$this->PageNumSubstitutions[$k][
'from']] = $this->PageNumSubstitutions[$k];
23745 } elseif ($this->PageNumSubstitutions[$k][
'from'] >= $target_page && $this->PageNumSubstitutions[$k][
'from'] < $start_page) {
23746 $this->PageNumSubstitutions[$k][
'from'] += $n_toc;
23747 $newarr[$this->PageNumSubstitutions[$k][
'from']] = $this->PageNumSubstitutions[$k];
23749 $newarr[$this->PageNumSubstitutions[$k][
'from']] = $this->PageNumSubstitutions[$k];
23753 if (!$sp_present) {
23754 $newarr[$target_page] = [
'from' => $target_page,
'suppress' => $sp_suppress,
'reset' => $sp_reset,
'type' => $sp_type];
23756 if (!$tp_present) {
23757 $newarr[($target_page + $n_toc)] = [
'from' => ($target_page + $n_toc),
'suppress' => $tp_suppress,
'reset' => $tp_reset,
'type' => $tp_type];
23759 if (!$ep_present && $end_page > count($this->pages)) {
23760 $newarr[($end_page + 1)] = [
'from' => ($end_page + 1),
'suppress' => $ep_suppress,
'reset' => $ep_reset,
'type' => $ep_type];
23763 $this->PageNumSubstitutions = [];
23764 foreach ($newarr as $v) {
23765 $this->PageNumSubstitutions[] = $v;
23773 if ($end_page < 1) {
23774 $end_page = $start_page;
23776 $n_tod = $end_page - $start_page + 1;
23777 $last_page = count($this->pages);
23778 $n_atend = $last_page - $end_page + 1;
23781 for ($i = 0; $i < $n_atend; $i++) {
23782 $this->pages[$start_page + $i] = $this->pages[$end_page + 1 + $i];
23785 for ($i = 0; $i < $n_tod; $i++) {
23786 unset($this->pages[$last_page - $i]);
23792 foreach ($this->BMoutlines as $i => $o) {
23793 if ($o[
'p'] >= $end_page) {
23794 $this->BMoutlines[$i][
'p'] -= $n_tod;
23795 } elseif ($p < $start_page) {
23796 unset($this->BMoutlines[$i]);
23802 if (count($this->PageLinks)) {
23804 foreach ($this->PageLinks as $i => $o) {
23805 foreach ($this->PageLinks[$i] as $key => $pl) {
23806 if (strpos($pl[4],
'@') === 0) {
23807 $p = substr($pl[4], 1);
23808 if ($p > $end_page) {
23809 $this->PageLinks[$i][$key][4] =
'@' . ($p - $n_tod);
23810 } elseif ($p < $start_page) {
23811 unset($this->PageLinks[$i][$key]);
23815 if ($i > $end_page) {
23816 $newarr[($i - $n_tod)] = $this->PageLinks[$i];
23817 } elseif ($p < $start_page) {
23818 $newarr[$i] = $this->PageLinks[$i];
23821 $this->PageLinks = $newarr;
23825 if (count($this->OrientationChanges)) {
23827 foreach ($this->OrientationChanges as $p => $v) {
23828 if ($p > $end_page) {
23829 $newarr[($p - $t_tod)] = $this->OrientationChanges[$p];
23830 } elseif ($p < $start_page) {
23831 $newarr[$p] = $this->OrientationChanges[$p];
23835 $this->OrientationChanges = $newarr;
23839 if (count($this->pageDim)) {
23841 foreach ($this->pageDim as $p => $v) {
23842 if ($p > $end_page) {
23843 $newarr[($p - $n_tod)] = $this->pageDim[$p];
23844 } elseif ($p < $start_page) {
23845 $newarr[$p] = $this->pageDim[$p];
23849 $this->pageDim = $newarr;
23853 if (count($this->saveHTMLHeader)) {
23854 foreach ($this->saveHTMLHeader as $p => $v) {
23855 if ($p > $end_page) {
23856 $newarr[($p - $n_tod)] = $this->saveHTMLHeader[$p];
23858 elseif ($p < $start_page) {
23859 $newarr[$p] = $this->saveHTMLHeader[$p];
23863 $this->saveHTMLHeader = $newarr;
23865 if (count($this->saveHTMLFooter)) {
23867 foreach ($this->saveHTMLFooter as $p => $v) {
23868 if ($p > $end_page) {
23869 $newarr[($p - $n_tod)] = $this->saveHTMLFooter[$p];
23870 } elseif ($p < $start_page) {
23871 $newarr[$p] = $this->saveHTMLFooter[$p];
23875 $this->saveHTMLFooter = $newarr;
23879 foreach ($this->internallink as $key => $o) {
23880 if ($o[
'PAGE'] > $end_page) {
23881 $this->internallink[$key][
'PAGE'] -= $n_tod;
23882 } elseif ($o[
'PAGE'] < $start_page) {
23883 unset($this->internallink[$key]);
23888 foreach ($this->links as $key => $o) {
23889 if ($o[0] > $end_page) {
23890 $this->links[$key][0] -= $n_tod;
23891 } elseif ($o[0] < $start_page) {
23892 unset($this->links[$key]);
23897 foreach ($this->form->forms as $key => $f) {
23898 if ($f[
'page'] > $end_page) {
23899 $this->form->forms[$key][
'page'] -= $n_tod;
23900 } elseif ($f[
'page'] < $start_page) {
23901 unset($this->form->forms[$key]);
23907 if (count($this->PageAnnots)) {
23909 foreach ($this->PageAnnots as $p => $anno) {
23910 if ($p > $end_page) {
23911 foreach ($anno as $o) {
23912 $newarr[($p - $n_tod)][] = $o;
23914 } elseif ($p < $start_page) {
23915 $newarr[$p] = $this->PageAnnots[$p];
23919 $this->PageAnnots = $newarr;
23924 foreach ($this->PageNumSubstitutions as $k => $v) {
23925 if ($this->PageNumSubstitutions[$k][
'from'] > $end_page) {
23926 $this->PageNumSubstitutions[$k][
'from'] -= $n_tod;
23927 } elseif ($this->PageNumSubstitutions[$k][
'from'] < $start_page) {
23928 unset($this->PageNumSubstitutions[$k]);
23933 $this->page = count($this->pages);
23943 $this->IndexEntrySee($txt, $xref);
23949 if ($this->keep_block_together) {
23951 } elseif ($this->kwt) {
23952 $size = count($this->kwt_Reference);
23953 for ($i = 0; $i < $size; $i++) {
23954 if (isset($this->kwt_Reference[$i][
't']) && $this->kwt_Reference[$i][
't'] == $txt) {
23956 if ($this->page != $this->kwt_Reference[$i][
'op']) {
23957 $this->kwt_Reference[$i][
'op'] = $this->page;
23962 $this->kwt_Reference[] = [
't' => $txt,
'op' => $this->page];
23965 $size = count($this->Reference);
23966 for ($i = 0; $i < $size; $i++) {
23967 if (isset($this->Reference[$i][
't']) && $this->Reference[$i][
't'] == $txt) {
23969 if (!in_array($this->page, $this->Reference[$i][
'p'])) {
23970 $this->Reference[$i][
'p'][] = $this->page;
23975 $this->Reference[] = [
't' => $txt,
'p' => [$this->page]];
23983 if ($this->directionality ==
'rtl') {
23985 if ($txta == strip_tags($txta)) {
23986 $txta = str_replace(
':',
' - ', $txta);
23988 if ($txtb == strip_tags($txtb)) {
23989 $txtb = str_replace(
':',
' - ', $txtb);
23993 if ($txta == strip_tags($txta)) {
23994 $txta = str_replace(
':',
', ', $txta);
23996 if ($txtb == strip_tags($txtb)) {
23997 $txtb = str_replace(
':',
', ', $txtb);
24000 $this->Reference[] = [
't' => $txta .
' - see ' . $txtb,
'p' => []];
24003 private function filesInDir($directory)
24006 foreach ((
new \DirectoryIterator($directory)) as $v) {
24007 if ($v->isDir() || $v->isDot()) {
24011 $files[] = $v->getPathname();
24017 function InsertIndex($usedivletters = 1, $useLinking =
false, $indexCollationLocale =
'', $indexCollationGroup =
'')
24019 $size = count($this->Reference);
24031 $spacer =
"\xc2\xa0 ";
24032 if ($this->directionality ==
'rtl') {
24033 $sep =
'، ';
24035 $subEntrySeparator =
'، ';
24036 $subEntryInset =
' - ';
24040 $subEntrySeparator =
', ';
24041 $subEntryInset =
' - ';
24044 for ($i = 0; $i < $size; $i++) {
24045 $txt = $this->Reference[$i][
't'];
24046 $txt = strip_tags($txt);
24047 $txt = $this->purify_utf8($txt);
24048 $this->Reference[$i][
'uf'] = $txt;
24052 if ($usedivletters) {
24053 if ($indexCollationGroup && \in_array(strtolower($indexCollationGroup), array_map(
function ($v) {
24054 return strtolower(basename($v,
'.php'));
24055 }, $this->filesInDir(__DIR__ .
'/../data/collations/')))) {
24056 $collation = require __DIR__ .
'/../data/collations/' . $indexCollationGroup .
'.php';
24060 for ($i = 0; $i < $size; $i++) {
24061 if ($this->Reference[$i][
'uf']) {
24062 $l = mb_substr($this->Reference[$i][
'uf'], 0, 1,
'UTF-8');
24063 if (isset($indexCollationGroup) && $indexCollationGroup) {
24064 $uni = $this->UTF8StringToArray($l);
24066 if (isset($collation[$ucode])) {
24069 $this->Reference[$i][
'd'] = mb_strtolower($l,
'UTF-8');
24072 $this->Reference[$i][
'd'] = mb_strtolower($l,
'UTF-8');
24079 $originalLocale = setlocale(LC_COLLATE, 0);
24080 if ($indexCollationLocale) {
24081 setlocale(LC_COLLATE, $indexCollationLocale);
24084 usort($this->Reference,
function ($a, $b) {
24085 return strcoll(strtolower($a[
'uf']), strtolower($b[
'uf']));
24088 if ($indexCollationLocale) {
24089 setlocale(LC_COLLATE, $originalLocale);
24092 $html =
'<div class="mpdf_index_main">';
24097 for ($i = 0; $i < $size; $i++) {
24098 if ($this->Reference[$i][
't']) {
24099 if ($usedivletters) {
24100 $lett = $this->Reference[$i][
'd'];
24101 if ($lett != $last_lett) {
24102 $html .=
'<div class="mpdf_index_letter">' . $lett .
'</div>';
24105 $txt = $this->Reference[$i][
't'];
24109 $a = preg_split(
'/(<.*?>)/', $txt, -1, PREG_SPLIT_DELIM_CAPTURE);
24112 foreach ($a as $k => $e) {
24113 if ($k % 2 == 0 && !$marker) {
24114 if (strpos($e,
':') !==
false) {
24115 if ($this->indexUseSubentries) {
24118 list($txtmain, $sub) = preg_split(
'/[:]/', $e, 2);
24119 if (strip_tags($txt . $txtmain) != $mainentry) {
24120 $html .=
'<div class="mpdf_index_entry">' . $txt . $txtmain .
'</div>';
24121 $mainentry = strip_tags($txt . $txtmain);
24124 $txt = $subEntryInset;
24127 $e = preg_replace(
'/[:]/', $subEntrySeparator, $e, 1);
24136 $mainentry = strip_tags($txt);
24139 $html .=
'<div class="mpdf_index_entry">';
24141 $ppp = $this->Reference[$i][
'p'];
24145 $range_start = $ppp[0];
24150 for ($zi = 1; $zi < count($ppp); $zi++) {
24151 if ($ppp[$zi] == ($ppp[($zi - 1)] + 1)) {
24152 $range_end = $ppp[$zi];
24155 if ($range_end == $range_start + 1) {
24157 $html .=
'<a class="mpdf_index_link" href="@' . $range_start .
'">';
24159 $html .= $this->docPageNum($range_start);
24166 $html .=
'<a class="mpdf_index_link" href="@' . $ppp[$zi - 1] .
'">';
24168 $html .= $this->docPageNum($ppp[$zi - 1]);
24176 $html .=
'<a class="mpdf_index_link" href="@' . $ppp[$zi - 1] .
'">';
24178 $html .= $this->docPageNum($ppp[$zi - 1]);
24184 $range_start = $ppp[$zi];
24191 $html .=
'<a class="mpdf_index_link" href="@' . $range_start .
'">';
24193 $html .= $this->docPageNum($range_start);
24194 if ($range_end == $range_start + 1) {
24200 $html .=
'<a class="mpdf_index_link" href="@' . $range_end .
'">';
24202 $html .= $this->docPageNum($range_end);
24208 $html .= $this->docPageNum($range_end);
24215 $html .=
'<a class="mpdf_index_link" href="@' . $ppp[(count($ppp) - 1)] .
'">';
24217 $html .= $this->docPageNum($ppp[(count($ppp) - 1)]);
24225 $last_lett = $lett;
24228 $save_fpb = $this->fixedPosBlockSave;
24229 $this->WriteHTML(
$html);
24230 $this->fixedPosBlockSave = $save_fpb;
24232 $this->breakpoints[$this->CurrCol][] = $this->y;
24239 if (count($this->cellBorderBuffer)) {
24240 $this->printcellbuffer();
24243 if ($this->ColActive == 1) {
24244 if ($this->CurrCol < $this->NbCol - 1) {
24247 $this->SetCol($this->CurrCol);
24248 $this->y = $this->y0;
24249 $this->ChangeColumn = 1;
24251 if ($this->directionality ==
'rtl') {
24252 $this->ChangeColumn = -($this->ChangeColumn);
24258 if (count($this->columnbuffer)) {
24259 $this->printcolumnbuffer();
24262 $this->y0 = $this->tMargin;
24263 $this->ChangeColumn = -($this->NbCol - 1);
24265 if ($this->directionality ==
'rtl') {
24266 $this->ChangeColumn = -($this->ChangeColumn);
24272 elseif ($this->table_rotate) {
24273 if ($this->tablebuffer) {
24274 $this->printtablebuffer();
24278 $this->ChangeColumn = 0;
24279 return $this->autoPageBreak;
24281 return $this->autoPageBreak;
24292 if ($this->ColActive) {
24293 $this->ColActive = 0;
24294 if (count($this->columnbuffer)) {
24295 $this->printcolumnbuffer();
24298 $this->ResetMargins();
24299 $this->pgwidth = $this->w - $this->lMargin - $this->rMargin;
24300 $this->divwidth = 0;
24303 $this->ColActive = 0;
24304 $this->columnbuffer = [];
24305 $this->ColDetails = [];
24306 $this->columnLinks = [];
24307 $this->columnAnnots = [];
24308 $this->columnForms = [];
24309 $this->col_BMoutlines = [];
24310 $this->col_toc = [];
24311 $this->breakpoints = [];
24313 if ($this->ColActive) {
24314 $this->ColActive = 0;
24315 if (count($this->columnbuffer)) {
24316 $this->printcolumnbuffer();
24318 $this->ResetMargins();
24320 if (isset($this->y) && $this->y > $this->tMargin) {
24323 $this->NbCol = $NbCol;
24324 $this->ColGap = $gap;
24325 $this->divwidth = 0;
24326 $this->ColActive = 1;
24327 $this->ColumnAdjust =
true;
24328 $this->columnbuffer = [];
24329 $this->ColDetails = [];
24330 $this->columnLinks = [];
24331 $this->columnAnnots = [];
24332 $this->columnForms = [];
24333 $this->col_BMoutlines = [];
24334 $this->col_toc = [];
24335 $this->breakpoints = [];
24336 if ((strtoupper($vAlign) ==
'J') || (strtoupper($vAlign) ==
'JUSTIFY')) {
24341 $this->colvAlign = $vAlign;
24343 $absL = $this->DeflMargin - ($gap / 2);
24344 $absR = $this->DefrMargin - ($gap / 2);
24345 $PageWidth = $this->w - $absL - $absR;
24346 $ColWidth = (($PageWidth - ($gap * ($NbCol))) / $NbCol);
24347 $this->ColWidth = $ColWidth;
24350 if ($this->directionality ==
'rtl') {
24351 for ($i = 0; $i < $this->NbCol; $i++) {
24352 $this->ColL[$i] = $absL + ($gap / 2) + (($NbCol - ($i + 1)) * ($PageWidth / $NbCol));
24353 $this->ColR[$i] = $this->ColL[$i] + $ColWidth;
24357 for ($i = 0; $i < $this->NbCol; $i++) {
24358 $this->ColL[$i] = $absL + ($gap / 2) + ($i * ($PageWidth / $NbCol) );
24359 $this->ColR[$i] = $this->ColL[$i] + $ColWidth;
24362 $this->pgwidth = $ColWidth;
24364 $this->y0 = $this->y;
24366 $this->x = $this->lMargin;
24373 $this->CurrCol = $CurrCol;
24374 $x = $this->ColL[$CurrCol];
24375 $xR = $this->ColR[$CurrCol];
24376 if (($this->mirrorMargins) && (($this->page) % 2 == 0)) {
24377 $x += $this->MarginCorrection;
24378 $xR += $this->MarginCorrection;
24380 $this->SetMargins($x, ($this->w - $xR), $this->tMargin);
24385 $this->NewColumn();
24386 $this->ColumnAdjust =
false;
24391 if ($this->ColActive == 1) {
24392 if ($this->CurrCol < $this->NbCol - 1) {
24395 $this->SetCol($this->CurrCol);
24396 $this->y = $this->y0;
24397 $this->ChangeColumn = 1;
24399 if ($this->directionality ==
'rtl') {
24400 $this->ChangeColumn = -($this->ChangeColumn);
24406 if (count($this->columnbuffer)) {
24407 $this->printcolumnbuffer();
24409 $this->
AddPage($this->CurOrientation);
24411 $this->y0 = $this->tMargin;
24412 $this->ChangeColumn = -($this->NbCol - 1);
24414 if ($this->directionality ==
'rtl') {
24415 $this->ChangeColumn = -($this->ChangeColumn);
24418 $this->x = $this->lMargin;
24420 $this->
AddPage($this->CurOrientation);
24427 if (!$this->ColActive && $this->ColumnAdjust && !$this->keepColumns) {
24429 $this->ColDetails[0][
'add_y'] = 0;
24432 for ($i = 1; $i < $this->NbCol; $i++) {
24433 if (isset($this->ColDetails[$i][
'bottom_margin']) && $this->ColDetails[$i][
'bottom_margin']) {
24434 $this->ColDetails[$i][
'add_y'] = ($this->ColDetails[$i - 1][
'bottom_margin'] - $this->y0) + $this->ColDetails[$i - 1][
'add_y'];
24440 foreach ($this->columnbuffer as $key => $s) {
24442 if ($t ==
'ACROFORM') {
24443 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24444 $this->columnbuffer[$key][
's'] =
'';
24445 } elseif (preg_match(
'/BT \d+\.\d\d+ (\d+\.\d\d+) Td/', $t)) {
24446 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24447 } elseif (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/', $t)) {
24448 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24449 } elseif (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) m/', $t)) {
24450 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24451 } elseif (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) l/', $t)) {
24452 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24453 } elseif (preg_match(
'/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/', $t)) {
24454 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24455 } elseif (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/', $t)) {
24456 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'] + $this->ColDetails[$s[
'col']][
'add_y'] - $this->y0;
24459 foreach ($this->internallink as $key => $f) {
24460 if (is_array($f) && isset($f[
'col'])) {
24461 $this->internallink[$key][
'rel_y'] = $f[
'Y'] + $this->ColDetails[$f[
'col']][
'add_y'] - $this->y0;
24466 foreach ($this->breakpoints as $c => $bpa) {
24467 foreach ($bpa as $rely) {
24468 $breaks[] = $rely + $this->ColDetails[$c][
'add_y'] - $this->y0;
24473 if (isset($this->ColDetails[$last_col][
'bottom_margin'])) {
24474 $lcbm = $this->ColDetails[$last_col][
'bottom_margin'];
24478 $sum_h = $this->ColDetails[$last_col][
'add_y'] + $lcbm - $this->y0;
24480 $target_h = ($sum_h / $this->NbCol);
24483 for ($i = 1; $i < $this->NbCol; $i++) {
24484 $th = ($sum_h * $i / $this->NbCol);
24485 foreach ($breaks as $bk => $val) {
24487 if (($val - $th) < ($th - $breaks[$bk - 1])) {
24488 $cbr[$i - 1] = $val;
24490 $cbr[$i - 1] = $breaks[$bk - 1];
24496 $cbr[($this->NbCol - 1)] = $sum_h;
24500 if (isset($cbr[0]) && $cbr[0] == 0) {
24501 for ($i = 0; $i < $this->NbCol - 1; $i++) {
24502 $cbr[$i] = $cbr[$i + 1];
24510 $last_col_bottom = 0;
24511 $lowest_bottom_y = 0;
24514 foreach ($this->columnbuffer as $key => $s) {
24515 if (isset($s[
'rel_y'])) {
24516 if ($s[
'rel_y'] >= $cbr[$newcolumn]) {
24519 $newcolumn = $last_new_col;
24523 $block_bottom = max($block_bottom, ($s[
'rel_y'] + $s[
'h']));
24525 if ($this->directionality ==
'rtl') {
24526 $xadj = -(($newcolumn - $s[
'col']) * ($this->ColWidth + $this->ColGap));
24529 $xadj = ($newcolumn - $s[
'col']) * ($this->ColWidth + $this->ColGap);
24532 if ($last_new_col != $newcolumn) {
24533 $last_col_bottom = $this->columnbuffer[$key][
'rel_y'];
24536 $yadj = ($s[
'rel_y'] - $s[
'y']) - ($last_col_bottom) + $this->y0;
24541 $t = $this->columnAdjustPregReplace(
'Td', $xadj, $yadj,
'/BT (\d+\.\d\d+) (\d+\.\d\d+) Td/', $t);
24542 $t = $this->columnAdjustPregReplace(
're', $xadj, $yadj,
'/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) ([\-]{0,1}\d+\.\d\d+) re/', $t);
24543 $t = $this->columnAdjustPregReplace(
'l', $xadj, $yadj,
'/(\d+\.\d\d+) (\d+\.\d\d+) l/', $t);
24544 $t = $this->columnAdjustPregReplace(
'img', $xadj, $yadj,
'/q (\d+\.\d\d+) 0 0 (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) cm \/(I|FO)/', $t);
24545 $t = $this->columnAdjustPregReplace(
'draw', $xadj, $yadj,
'/(\d+\.\d\d+) (\d+\.\d\d+) m/', $t);
24546 $t = $this->columnAdjustPregReplace(
'bezier', $xadj, $yadj,
'/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) c/', $t);
24548 $this->columnbuffer[$key][
's'] = $t;
24549 $this->columnbuffer[$key][
'newcol'] = $newcolumn;
24550 $this->columnbuffer[$key][
'newy'] = $s[
'y'] + $yadj;
24551 $last_new_col = $newcolumn;
24552 $clb = $s[
'y'] + $yadj + $s[
'h'];
24553 if ((isset($this->ColDetails[$newcolumn][
'max_bottom']) && $clb > $this->ColDetails[$newcolumn][
'max_bottom']) || (!isset($this->ColDetails[$newcolumn][
'max_bottom']) && $clb)) {
24554 $this->ColDetails[$newcolumn][
'max_bottom'] = $clb;
24556 if ($clb > $lowest_bottom_y) {
24557 $lowest_bottom_y = $clb;
24560 if (isset($this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24561 $ref = $this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24562 $this->PageLinks[$this->page][$ref][0] += ($xadj * Mpdf::SCALE);
24563 $this->PageLinks[$this->page][$ref][1] -= ($yadj * Mpdf::SCALE);
24564 unset($this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24567 if (isset($this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24568 $ref = $this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24569 $this->form->forms[$ref][
'x'] += ($xadj);
24570 $this->form->forms[$ref][
'y'] += ($yadj);
24571 unset($this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24574 if (isset($this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24575 $ref = $this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24576 if ($this->PageAnnots[$this->page][$ref][
'x'] < 0) {
24577 $this->PageAnnots[$this->page][$ref][
'x'] -= ($xadj);
24579 $this->PageAnnots[$this->page][$ref][
'x'] += ($xadj);
24581 $this->PageAnnots[$this->page][$ref][
'y'] += ($yadj);
24582 unset($this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24590 foreach ($this->col_BMoutlines as $v) {
24591 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $this->y0,
'p' => $v[
'p']];
24598 foreach ($this->col_toc as $v) {
24599 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $v[
'p'],
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
24600 $this->links[$v[
'link']][1] = $this->y0;
24605 if ($this->colvAlign ==
'J') {
24606 foreach ($this->columnbuffer as $key => $s) {
24607 if (isset($s[
'rel_y'])) {
24609 if (isset($this->ColDetails[$s[
'newcol']][
'max_bottom']) && $this->ColDetails[$s[
'newcol']][
'max_bottom'] && $this->ColDetails[$s[
'newcol']][
'max_bottom'] != $this->y0) {
24610 $ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s[
'newcol']][
'max_bottom'] - ($this->y0));
24614 if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
24615 $yadj = ($s[
'newy'] - $this->y0) * ($ratio - 1);
24618 if (isset($this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24619 $ref = $this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24620 $this->PageLinks[$this->page][$ref][1] -= ($yadj * Mpdf::SCALE);
24621 $this->PageLinks[$this->page][$ref][3] *= $ratio;
24622 unset($this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24625 if (isset($this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24626 $ref = $this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24627 $this->form->forms[$ref][
'x'] += ($xadj);
24628 $this->form->forms[$ref][
'y'] += ($yadj);
24629 unset($this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24632 if (isset($this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24633 $ref = $this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24634 $this->PageAnnots[$this->page][$ref][
'y'] += ($yadj);
24635 unset($this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24641 foreach ($this->internallink as $key => $f) {
24642 if (is_array($f) && isset($f[
'col'])) {
24643 $last_col_bottom = 0;
24644 for ($nbc = 0; $nbc < $this->NbCol; $nbc++) {
24645 if ($f[
'rel_y'] >= $cbr[$nbc]) {
24646 $last_col_bottom = $cbr[$nbc];
24649 $yadj = ($f[
'rel_y'] - $f[
'Y']) - $last_col_bottom + $this->y0;
24652 unset($f[
'rel_y']);
24653 $this->internallink[$key] = $f;
24659 foreach ($this->columnbuffer as $key => $s) {
24660 if (isset($s[
'rel_y'])) {
24662 if (isset($this->ColDetails[$s[
'newcol']][
'max_bottom']) && $this->ColDetails[$s[
'newcol']][
'max_bottom'] && $this->ColDetails[$s[
'newcol']][
'max_bottom'] != $this->y0) {
24663 $ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s[
'newcol']][
'max_bottom'] - ($this->y0));
24667 if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
24669 $this->pages[$this->page] .= $this->StartTransform(
true) .
"\n";
24670 $this->pages[$this->page] .= $this->transformScale(100, $ratio * 100, $x =
'', $this->y0,
true) .
"\n";
24675 $this->pages[$this->page] .= $s[
's'] .
"\n";
24676 if (isset($s[
'rel_y']) && ($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
24678 $this->pages[$this->page] .= $this->StopTransform(
true) .
"\n";
24683 $this->pages[$this->page] .= $this->StopTransform(
true) .
"\n";
24687 foreach ($this->columnbuffer as $s) {
24688 $this->pages[$this->page] .= $s[
's'] .
"\n";
24691 if ($lowest_bottom_y > 0) {
24692 $this->y = $lowest_bottom_y;
24695 elseif ($this->colvAlign ==
'J' && $this->ColumnAdjust && !$this->keepColumns) {
24697 $lowest_bottom_y = 0;
24698 foreach ($this->columnbuffer as $key => $s) {
24701 if ($t ==
'ACROFORM' || (preg_match(
'/BT \d+\.\d\d+ (\d+\.\d\d+) Td/', $t)) || (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/', $t)) ||
24702 (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) l/', $t)) ||
24703 (preg_match(
'/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/', $t)) ||
24704 (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) m/', $t)) ||
24705 (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/', $t))) {
24706 $clb = $s[
'y'] + $s[
'h'];
24707 if ((isset($this->ColDetails[$s[
'col']][
'max_bottom']) && $clb > $this->ColDetails[$s[
'col']][
'max_bottom']) || !isset($this->ColDetails[$s[
'col']][
'max_bottom'])) {
24708 $this->ColDetails[$s[
'col']][
'max_bottom'] = $clb;
24710 if ($clb > $lowest_bottom_y) {
24711 $lowest_bottom_y = $clb;
24713 $this->columnbuffer[$key][
'rel_y'] = $s[
'y'];
24714 if ($t ==
'ACROFORM') {
24715 $this->columnbuffer[$key][
's'] =
'';
24720 foreach ($this->columnbuffer as $key => $s) {
24722 if (isset($this->ColDetails[$s[
'col']][
'max_bottom']) && $this->ColDetails[$s[
'col']][
'max_bottom']) {
24723 $ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s[
'col']][
'max_bottom'] - ($this->y0));
24727 if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
24728 $yadj = ($s[
'y'] - $this->y0) * ($ratio - 1);
24731 if (isset($s[
'rel_y'])) {
24733 if (isset($this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24734 $ref = $this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24735 $this->PageLinks[$this->page][$ref][1] -= ($yadj * Mpdf::SCALE);
24736 $this->PageLinks[$this->page][$ref][3] *= $ratio;
24737 unset($this->columnLinks[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24740 if (isset($this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24741 $ref = $this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24742 $this->form->forms[$ref][
'x'] += ($xadj);
24743 $this->form->forms[$ref][
'y'] += ($yadj);
24744 unset($this->columnForms[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24747 if (isset($this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])])) {
24748 $ref = $this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])];
24749 $this->PageAnnots[$this->page][$ref][
'y'] += ($yadj);
24750 unset($this->columnAnnots[$s[
'col']][intval($s[
'x'])][intval($s[
'y'])]);
24760 foreach ($this->col_BMoutlines as $v) {
24761 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $this->y0,
'p' => $v[
'p']];
24768 foreach ($this->col_toc as $v) {
24769 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $v[
'p'],
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
24770 $this->links[$v[
'link']][1] = $this->y0;
24775 foreach ($this->columnbuffer as $key => $s) {
24777 if (isset($s[
'rel_y'])) {
24780 if (isset($this->ColDetails[$s[
'col']][
'max_bottom']) && $this->ColDetails[$s[
'col']][
'max_bottom']) {
24781 $ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s[
'col']][
'max_bottom'] - ($this->y0));
24786 if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
24788 $this->pages[$this->page] .= $this->StartTransform(
true) .
"\n";
24789 $this->pages[$this->page] .= $this->transformScale(100, $ratio * 100, $x =
'', $this->y0,
true) .
"\n";
24795 $this->pages[$this->page] .= $s[
's'] .
"\n";
24796 if (isset($s[
'rel_y']) && ($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
24798 $this->pages[$this->page] .= $this->StopTransform(
true) .
"\n";
24804 $this->pages[$this->page] .= $this->StopTransform(
true) .
"\n";
24807 if ($lowest_bottom_y > 0) {
24808 $this->y = $lowest_bottom_y;
24814 $lowest_bottom_y = 0;
24816 if (!$this->ColActive && (!$this->ColumnAdjust || $this->keepColumns)) {
24819 foreach ($this->columnbuffer as $key => $s) {
24823 if ($t ===
'ACROFORM'
24824 || (preg_match(
'/BT \d+\.\d\d+ (\d+\.\d\d+) Td/', $t))
24825 || (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/', $t))
24826 || (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) l/', $t))
24827 || (preg_match(
'/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/', $t))
24828 || (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) m/', $t))
24829 || (preg_match(
'/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/', $t))) {
24831 $clb = $s[
'y'] + $s[
'h'];
24833 if (isset($this->ColDetails[$s[
'col']][
'max_bottom']) && $clb > $this->ColDetails[$s[
'col']][
'max_bottom'] || (!isset($this->ColDetails[$s[
'col']][
'max_bottom']) && $clb)) {
24834 $this->ColDetails[$s[
'col']][
'max_bottom'] = $clb;
24837 if ($clb > $lowest_bottom_y) {
24838 $lowest_bottom_y = $clb;
24844 foreach ($this->columnbuffer as $key => $s) {
24845 if ($s[
's'] !=
'ACROFORM') {
24846 $this->pages[$this->page] .= $s[
's'] .
"\n";
24850 if ($lowest_bottom_y > 0) {
24851 $this->y = $lowest_bottom_y;
24856 foreach ($this->col_BMoutlines as $v) {
24857 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $v[
'y'],
'p' => $v[
'p']];
24863 foreach ($this->col_toc as $v) {
24864 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $v[
'p'],
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
24869 foreach ($this->internallink as $key => $f) {
24871 if (isset($this->internallink[$key][
'col'])) {
24872 unset($this->internallink[$key][
'col']);
24875 if (isset($this->internallink[$key][
'rel_y'])) {
24876 unset($this->internallink[$key][
'rel_y']);
24880 $this->columnbuffer = [];
24881 $this->ColDetails = [];
24882 $this->columnLinks = [];
24883 $this->columnAnnots = [];
24884 $this->columnForms = [];
24886 $this->col_BMoutlines = [];
24887 $this->col_toc = [];
24888 $this->breakpoints = [];
24894 preg_match($pattern, $subject, $matches);
24896 if (!count($matches)) {
24900 if (!isset($matches[3])) {
24904 if (!isset($matches[4])) {
24908 if (!isset($matches[5])) {
24912 if (!isset($matches[6])) {
24916 return str_replace($matches[0], $this->columnAdjustAdd($type, Mpdf::SCALE, $xadj, $yadj, $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), $subject);
24924 if (count($this->cellBorderBuffer)) {
24926 sort($this->cellBorderBuffer);
24928 foreach ($this->cellBorderBuffer as $cbb) {
24930 $cba = unpack(
"A16dom/nbord/A1side/ns/dbw/a6ca/A10style/dx/dy/dw/dh/dmbl/dmbr/dmrt/dmrb/dmtl/dmtr/dmlt/dmlb/dcpd/dover/", $cbb);
24931 $side = $cba[
'side'];
24932 $color = str_pad($cba[
'ca'], 6,
"\x00");
24936 $details[$side][
'dom'] = (float) $cba[
'dom'];
24937 $details[$side][
's'] = $cba[
's'];
24938 $details[$side][
'w'] = $cba[
'bw'];
24939 $details[$side][
'c'] = $color;
24940 $details[$side][
'style'] = trim($cba[
'style']);
24942 $details[
'mbw'][
'BL'] = $cba[
'mbl'];
24943 $details[
'mbw'][
'BR'] = $cba[
'mbr'];
24944 $details[
'mbw'][
'RT'] = $cba[
'mrt'];
24945 $details[
'mbw'][
'RB'] = $cba[
'mrb'];
24946 $details[
'mbw'][
'TL'] = $cba[
'mtl'];
24947 $details[
'mbw'][
'TR'] = $cba[
'mtr'];
24948 $details[
'mbw'][
'LT'] = $cba[
'mlt'];
24949 $details[
'mbw'][
'LB'] = $cba[
'mlb'];
24951 $details[
'cellposdom'] = $cba[
'cpd'];
24953 $details[
'p'] = $side;
24955 if ($cba[
'over'] == 1) {
24956 $details[$side][
'overlay'] =
true;
24958 $details[$side][
'overlay'] =
false;
24961 $this->_tableRect($cba[
'x'], $cba[
'y'], $cba[
'w'], $cba[
'h'], $cba[
'bord'], $details,
false,
false);
24964 $this->cellBorderBuffer = [];
24972 if (!$this->table_rotate) {
24974 $this->pages[$this->page] .= $this->tablebuffer;
24976 foreach ($this->tbrot_Links as $p => $l) {
24977 foreach ($l as $v) {
24978 $this->PageLinks[$p][] = $v;
24981 $this->tbrot_Links = [];
24984 foreach ($this->tbrot_Annots as $p => $l) {
24985 foreach ($l as $v) {
24986 $this->PageAnnots[$p][] = $v;
24989 $this->tbrot_Annots = [];
24994 foreach ($this->tbrot_BMoutlines as $v) {
24995 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $v[
'y'],
'p' => $v[
'p']];
24997 $this->tbrot_BMoutlines = [];
25002 foreach ($this->tbrot_toc as $v) {
25003 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $v[
'p'],
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
25005 $this->tbrot_toc = [];
25012 $lm = $this->lMargin + $this->blk[$this->blklvl][
'outer_left_margin'] + $this->blk[$this->blklvl][
'border_left'][
'w'] + $this->blk[$this->blklvl][
'padding_left'];
25013 $pw = $this->blk[$this->blklvl][
'inner_width'];
25016 $this->pages[$this->page] .= $this->StartTransform(
true) .
"\n";
25018 if ($this->table_rotate > 1) {
25020 if ($this->tbrot_align ==
'L') {
25021 $xadj = $this->tbrot_h;
25022 } elseif ($this->tbrot_align ==
'R') {
25023 $xadj = $lm - $this->tbrot_x0 + ($pw);
25025 $xadj = $lm - $this->tbrot_x0 + (($pw + $this->tbrot_h) / 2);
25032 if ($this->tbrot_align ==
'L') {
25034 } elseif ($this->tbrot_align ==
'R') {
25035 $xadj = $lm - $this->tbrot_x0 + ($pw - $this->tbrot_h);
25037 $xadj = $lm - $this->tbrot_x0 + (($pw - $this->tbrot_h) / 2);
25040 $yadj = $this->tbrot_w;
25044 $this->pages[$this->page] .= $this->transformTranslate($xadj, $yadj,
true) .
"\n";
25045 $this->pages[$this->page] .= $this->transformRotate($this->table_rotate, $this->tbrot_x0, $this->tbrot_y0,
true) .
"\n";
25048 $this->pages[$this->page] .= $this->tablebuffer;
25050 foreach ($this->tbrot_Links as $p => $l) {
25052 foreach ($l as $v) {
25054 $w = $v[2] / Mpdf::SCALE;
25055 $h = $v[3] / Mpdf::SCALE;
25056 $ax = ($v[0] / Mpdf::SCALE) - $this->tbrot_x0;
25057 $ay = (($this->hPt - $v[1]) / Mpdf::SCALE) - $this->tbrot_y0;
25059 if ($this->table_rotate > 1) {
25060 $bx = $this->tbrot_x0 + $xadj - $ay - $h;
25061 $by = $this->tbrot_y0 + $yadj + $ax;
25063 $bx = $this->tbrot_x0 + $xadj + $ay;
25064 $by = $this->tbrot_y0 + $yadj - $ax - $w;
25067 $v[0] = $bx * Mpdf::SCALE;
25068 $v[1] = ($this->h - $by) * Mpdf::SCALE;
25069 $v[2] = $h * Mpdf::SCALE;
25070 $v[3] = $w * Mpdf::SCALE;
25072 $this->PageLinks[$p][] = $v;
25076 $this->tbrot_Links = [];
25077 foreach ($this->internallink as $key => $f) {
25078 if (is_array($f) && isset($f[
'tbrot'])) {
25079 $f[
'Y'] = $this->tbrot_y0;
25080 $f[
'PAGE'] = $this->page;
25081 unset($f[
'tbrot']);
25082 $this->internallink[$key] = $f;
25087 foreach ($this->tbrot_Annots as $p => $l) {
25088 foreach ($l as $v) {
25089 $ax = abs($v[
'x']) - $this->tbrot_x0;
25090 $ay = $v[
'y'] - $this->tbrot_y0;
25092 if ($this->table_rotate > 1) {
25093 $bx = $this->tbrot_x0 + $xadj - $ay;
25094 $by = $this->tbrot_y0 + $yadj + $ax;
25096 $bx = $this->tbrot_x0 + $xadj + $ay;
25097 $by = $this->tbrot_y0 + $yadj - $ax;
25107 $this->PageAnnots[$p][] = $v;
25111 $this->tbrot_Annots = [];
25116 foreach ($this->tbrot_BMoutlines as $v) {
25117 $v[
'y'] = $this->tbrot_y0;
25118 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $v[
'y'],
'p' => $this->page];
25124 foreach ($this->tbrot_toc as $v) {
25125 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $this->page,
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
25126 $this->links[$v[
'link']][1] = $this->tbrot_y0;
25130 $this->tbrot_BMoutlines = [];
25131 $this->tbrot_toc = [];
25134 $this->pages[$this->page] .= $this->StopTransform(
true) .
"\n";
25136 $this->y = $this->tbrot_y0 + $this->tbrot_w;
25137 $this->x = $this->lMargin;
25139 $this->tablebuffer =
'';
25147 if (!$this->kwt_moved) {
25149 foreach ($this->kwt_buffer as $s) {
25150 $this->pages[$this->page] .= $s[
's'] .
"\n";
25153 foreach ($this->kwt_Links as $p => $l) {
25154 foreach ($l as $v) {
25155 $this->PageLinks[$p][] = $v;
25159 $this->kwt_Links = [];
25162 foreach ($this->kwt_Annots as $p => $l) {
25163 foreach ($l as $v) {
25164 $this->PageAnnots[$p][] = $v;
25167 $this->kwt_Annots = [];
25172 foreach ($this->kwt_Reference as $v) {
25176 for ($i = 0; $i < count($this->Reference); $i++) {
25177 if ($this->Reference[$i][
't'] == $v[
't']) {
25179 if (!in_array($v[
'op'], $this->Reference[$i][
'p'])) {
25180 $this->Reference[$i][
'p'][] = $v[
'op'];
25185 if ($Present == 0) {
25186 $this->Reference[] = [
't' => $v[
't'],
'p' => [$v[
'op']]];
25189 $this->kwt_Reference = [];
25194 foreach ($this->kwt_BMoutlines as $v) {
25195 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $v[
'y'],
'p' => $v[
'p']];
25197 $this->kwt_BMoutlines = [];
25202 foreach ($this->kwt_toc as $v) {
25203 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $v[
'p'],
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
25205 $this->kwt_toc = [];
25208 $this->pageoutput[$this->page] = [];
25214 $this->pages[$this->page] .= $this->StartTransform(
true) .
"\n";
25215 $xadj = $this->lMargin - $this->kwt_x0;
25217 $yadj = $this->tMargin - $this->kwt_y0;
25219 $this->pages[$this->page] .= $this->transformTranslate($xadj, $yadj,
true) .
"\n";
25222 foreach ($this->kwt_buffer as $s) {
25223 $this->pages[$this->page] .= $s[
's'] .
"\n";
25227 foreach ($this->kwt_Links as $p => $l) {
25228 foreach ($l as $v) {
25229 $bx = $this->kwt_x0 + $xadj;
25230 $by = $this->kwt_y0 + $yadj;
25231 $v[0] = $bx * Mpdf::SCALE;
25232 $v[1] = ($this->h - $by) * Mpdf::SCALE;
25233 $this->PageLinks[$p][] = $v;
25237 foreach ($this->internallink as $key => $f) {
25238 if (is_array($f) && isset($f[
'kwt'])) {
25240 $f[
'PAGE'] = $this->page;
25242 $this->internallink[$key] = $f;
25247 foreach ($this->kwt_Annots as $p => $l) {
25248 foreach ($l as $v) {
25249 $bx = $this->kwt_x0 + $xadj;
25250 $by = $this->kwt_y0 + $yadj;
25257 $this->PageAnnots[$p][] = $v;
25265 foreach ($this->kwt_BMoutlines as $v) {
25266 if ($v[
'y'] != 0) {
25269 $this->BMoutlines[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'y' => $v[
'y'],
'p' => $this->page];
25275 foreach ($this->kwt_Reference as $v) {
25280 for ($i = 0; $i < count($this->Reference); $i++) {
25281 if ($this->Reference[$i][
't'] == $v[
't']) {
25283 if (!in_array($this->page, $this->Reference[$i][
'p'])) {
25284 $this->Reference[$i][
'p'][] = $this->page;
25289 if ($Present == 0) {
25290 $this->Reference[] = [
't' => $v[
't'],
'p' => [$this->page]];
25298 foreach ($this->kwt_toc as $v) {
25299 $this->tableOfContents->_toc[] = [
't' => $v[
't'],
'l' => $v[
'l'],
'p' => $this->page,
'link' => $v[
'link'],
'toc_id' => $v[
'toc_id']];
25300 $this->links[$v[
'link']][0] = $this->page;
25301 $this->links[$v[
'link']][1] += $yadj;
25306 $this->kwt_Links = [];
25307 $this->kwt_Annots = [];
25309 $this->kwt_Reference = [];
25310 $this->kwt_BMoutlines = [];
25311 $this->kwt_toc = [];
25314 $this->pages[$this->page] .= $this->StopTransform(
true) .
"\n";
25316 $this->kwt_buffer = [];
25318 $this->y += $this->kwt_height;
25319 $this->pageoutput[$this->page] = [];
25325 if (count($this->floatbuffer)) {
25326 $this->objectbuffer = $this->floatbuffer;
25327 $this->printobjectbuffer(
false);
25328 $this->objectbuffer = [];
25329 $this->floatbuffer = [];
25330 $this->floatmargins = [];
25336 $this->Ellipse($x, $y, $r, $r, $style);
25341 if ($style ===
'F') {
25343 } elseif ($style ===
'FD' or $style ===
'DF') {
25349 $lx = 4 / 3 * (M_SQRT2 - 1) * $rx;
25350 $ly = 4 / 3 * (M_SQRT2 - 1) * $ry;
25354 $this->writer->write(sprintf(
'%.3F %.3F m %.3F %.3F %.3F %.3F %.3F %.3F c', ($x + $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE, ($x + $rx) * Mpdf::SCALE, ($h - ($y - $ly)) * Mpdf::SCALE, ($x + $lx) * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE, $x * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE));
25355 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c', ($x - $lx) * Mpdf::SCALE, ($h - ($y - $ry)) * Mpdf::SCALE, ($x - $rx) * Mpdf::SCALE, ($h - ($y - $ly)) * Mpdf::SCALE, ($x - $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE));
25356 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c', ($x - $rx) * Mpdf::SCALE, ($h - ($y + $ly)) * Mpdf::SCALE, ($x - $lx) * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE, $x * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE));
25357 $this->writer->write(sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F c %s', ($x + $lx) * Mpdf::SCALE, ($h - ($y + $ry)) * Mpdf::SCALE, ($x + $rx) * Mpdf::SCALE, ($h - ($y + $ly)) * Mpdf::SCALE, ($x + $rx) * Mpdf::SCALE, ($h - $y) * Mpdf::SCALE, $op));
25364 $text =
' ' . $text .
' ';
25366 $this->
SetFont($font, $style, $szfont,
false);
25368 $text = $this->purify_utf8_text($text);
25369 if ($this->text_input_as_HTML) {
25370 $text = $this->all_entities_to_utf8($text);
25372 if ($this->usingCoreFont) {
25373 $text = mb_convert_encoding($text, $this->mb_enc,
'UTF-8');
25377 if (preg_match(
"/([" . $this->pregRTLchars .
"])/u", $text)) {
25378 $this->biDirectional =
true;
25382 $save_OTLtags = $this->OTLtags;
25383 $this->OTLtags = [];
25385 if ($this->useKerning) {
25386 if ($this->CurrentFont[
'haskernGPOS']) {
25387 $this->OTLtags[
'Plus'] .=
' kern';
25395 if (isset($this->CurrentFont[
'useOTL']) && $this->CurrentFont[
'useOTL']) {
25396 $text = $this->otl->applyOTL($text, $this->CurrentFont[
'useOTL']);
25397 $OTLdata = $this->otl->OTLdata;
25401 $this->OTLtags = $save_OTLtags;
25403 $this->magic_reverse_dir($text, $this->directionality, $OTLdata);
25405 $width = $this->sizeConverter->convert($w);
25408 while ($loop == 0) {
25410 $this->
SetFont($font, $style, $szfont,
false);
25411 $sz = $this->GetStringWidth($text,
true, $OTLdata, $textvar);
25420 $this->
SetFont($font, $style, $szfont,
true,
true);
25421 $this->Cell($w, 0, $text, 0, 0,
"C", 0,
'', 0, 0, 0,
'M', 0,
false, $OTLdata, $textvar);
25431 if ($this->usingCoreFont) {
25435 if ($chunk ==
'') {
25439 if ($this->biDirectional || $dir ==
'rtl') {
25443 $pregRTLchars = $this->pregRTLchars;
25445 if (isset($this->CurrentFont[
'rtlPUAstr']) && $this->CurrentFont[
'rtlPUAstr']) {
25446 $pregRTLchars .= $this->CurrentFont[
'rtlPUAstr'];
25449 if (!preg_match(
"/[" . $pregRTLchars .
"]/u", $chunk) && $dir !=
'rtl') {
25453 $unicode = $this->UTF8StringToArray($chunk,
false);
25456 if (empty($chunkOTLdata)) {
25457 $this->getBasicOTLdata($chunkOTLdata, $unicode, $isStrong);
25460 $useGPOS = isset($this->CurrentFont[
'useOTL']) && ($this->CurrentFont[
'useOTL'] & 0x80);
25463 list($chunk, $rtl_content) = $this->otl->bidiSort($unicode, $chunk, $dir, $chunkOTLdata, $useGPOS);
25465 return $rtl_content;
25476 if (empty($this->otl)) {
25477 $this->otl =
new Otl($this, $this->fontCache);
25480 $chunkOTLdata[
'group'] =
'';
25481 $chunkOTLdata[
'GPOSinfo'] = [];
25482 $chunkOTLdata[
'char_data'] = [];
25484 foreach ($unicode as $char) {
25487 $chunkOTLdata[
'char_data'][] = [
'bidi_class' => $ucd_record[2],
'uni' => $char];
25489 if ($ucd_record[2] == 0 || $ucd_record[2] == 3 || $ucd_record[2] == 4) {
25494 $chunkOTLdata[
'group'] .=
'M';
25495 } elseif ($char == 32 || $char == 12288) {
25496 $chunkOTLdata[
'group'] .=
'S';
25498 $chunkOTLdata[
'group'] .=
'C';
25507 if ($mode ==
'end') {
25510 if (strpos($bdf,
'PDF') !==
false) {
25514 if (strpos($bdf,
'PDI') !==
false) {
25518 } elseif ($mode ==
'start') {
25521 if (strpos($bdf,
'LRI') !==
false) {
25523 } elseif (strpos($bdf,
'RLI') !==
false) {
25525 } elseif (strpos($bdf,
'FSI') !==
false) {
25529 if (strpos($bdf,
'LRO') !==
false) {
25531 } elseif (strpos($bdf,
'RLO') !==
false) {
25533 } elseif (strpos($bdf,
'LRE') !==
false) {
25535 } elseif (strpos($bdf,
'RLE') !==
false) {
25547 require __DIR__ .
'/../data/subs_win-1252.php';
25548 $this->substitute = [];
25557 if (count($this->substitute)) {
25558 $a = preg_split(
'/(<.*?>)/ms',
$html, -1, PREG_SPLIT_DELIM_CAPTURE);
25560 foreach ($a as $i => $e) {
25562 $e = strtr($e, $this->substitute);
25573 if (preg_match(
"/^(.*?)([\x{20000}-\x{2FFFF}]+)(.*)/u", $writehtml_e, $m)) {
25574 if (isset($this->CurrentFont[
'sipext']) && $this->CurrentFont[
'sipext']) {
25575 $font = $this->CurrentFont[
'sipext'];
25576 if (!in_array($font, $this->available_unifonts)) {
25579 $writehtml_a[$writehtml_i] = $writehtml_e = $m[1];
25580 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'span style="font-family: ' . $font .
'"', $m[2],
'/span', $m[3]]);
25581 $this->subPos = $writehtml_i;
25595 if ($writehtml_i > 0 && strtolower(substr($writehtml_a[$writehtml_i - 1], 0, 8)) ==
'textarea') {
25599 if (mb_convert_encoding(mb_convert_encoding($writehtml_e, $this->mb_enc,
"UTF-8"),
"UTF-8", $this->mb_enc) == $writehtml_e) {
25603 $cw = &$this->CurrentFont[
'cw'];
25604 $unicode = $this->UTF8StringToArray($writehtml_e,
false);
25611 if (!$this->subArrMB) {
25613 require __DIR__ .
'/../data/subs_core.php';
25615 $this->subArrMB[
'a'] =
$aarr;
25616 $this->subArrMB[
's'] =
$sarr;
25617 $this->subArrMB[
'z'] =
$zarr;
25620 foreach ($unicode as $c => $char) {
25622 if (($char > 127 || ($flag == 1 && $char == 32)) && $char != 173 && (!isset($this->subArrMB[
'a'][$char]) || ($flag == 1 && $char == 32)) && ($char < 1536 || ($char > 1791 && $char < 2304) || $char > 3455)) {
25628 } elseif ($flag > 0) {
25634 if ($flag > 0 && !$end) {
25635 $end = count($unicode) - 1;
25638 if ($start == -1) {
25643 if (!is_array($this->backupSubsFont)) {
25644 $this->backupSubsFont = [
"$this->backupSubsFont"];
25647 foreach ($this->backupSubsFont as $bsfctr => $bsf) {
25649 if ($this->fonttrans[$bsf] ==
'chelvetica' || $this->fonttrans[$bsf] ==
'ctimes' || $this->fonttrans[$bsf] ==
'ccourier') {
25657 if (isset($this->fonts[$font])) {
25658 $cw = &$this->fonts[$font][
'cw'];
25659 } elseif ($this->fontCache->has($font .
'.cw.dat')) {
25660 $cw = $this->fontCache->load($font .
'.cw.dat');
25662 $prevFontFamily = $this->FontFamily;
25663 $prevFontStyle = $this->currentfontstyle;
25664 $prevFontSizePt = $this->FontSizePt;
25665 $this->
SetFont($bsf,
'',
'',
false);
25666 $this->
SetFont($prevFontFamily, $prevFontStyle, $prevFontSizePt,
false);
25674 foreach ($u as $char) {
25675 if ($char == 173 || $this->_charDefined(
$cw, $char) || ($char > 1536 && $char < 1791) || ($char > 2304 && $char < 3455 )) {
25678 if ($l == 0 && $bsfctr == (count($this->backupSubsFont) - 1)) {
25679 $cont = mb_substr($writehtml_e, $start + 1);
25680 $writehtml_e = mb_substr($writehtml_e, 0, $start + 1,
'UTF-8');
25681 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'', $cont]);
25682 $this->subPos = $writehtml_i + 1;
25692 $patt = mb_substr($writehtml_e, $start, $l,
'UTF-8');
25693 if (preg_match(
"/(.*?)(" . preg_quote($patt,
'/') .
")(.*)/u", $writehtml_e, $m)) {
25694 $writehtml_e = $m[1];
25695 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'span style="font-family: ' . $font .
'"', $m[2],
'/span', $m[3]]);
25696 $this->subPos = $writehtml_i + 3;
25711 if ($writehtml_i > 0 && strtolower(substr($writehtml_a[$writehtml_i - 1], 0, 8)) ==
'textarea') {
25715 $cw = &$this->CurrentFont[
'cw'];
25716 $unicode = $this->UTF8StringToArray($writehtml_e,
false);
25723 foreach ($unicode as $c => $char) {
25725 if (($flag == 0 || $flag == 2) && (!$this->_charDefined(
$cw, $char) || ($flag == 2 && $char == 32)) && $this->checkSIP && $char > 131071) {
25727 if (in_array($this->FontFamily, $this->available_CJK_fonts)) {
25740 } elseif (($flag == 0 || $flag == 1) && $char != 173 && (!$this->_charDefined(
$cw, $char) || ($flag == 1 && $char == 32)) && ($char < 1536 || ($char > 1791 && $char < 2304) || $char > 3455)) {
25749 } elseif ($flag > 0) {
25757 if ($flag > 0 && !$end) {
25758 $end = count($unicode) - 1;
25761 if ($start == -1) {
25768 if (isset($this->CurrentFont[
'sipext']) && $this->CurrentFont[
'sipext']) {
25769 $font = $this->CurrentFont[
'sipext'];
25773 if (isset($this->fonts[$font])) {
25774 $cw = &$this->fonts[$font][
'cw'];
25775 } elseif ($this->fontCache->has($font .
'.cw.dat')) {
25776 $cw = $this->fontCache->load($font .
'.cw.dat');
25778 $prevFontFamily = $this->FontFamily;
25779 $prevFontStyle = $this->currentfontstyle;
25780 $prevFontSizePt = $this->FontSizePt;
25781 $this->
SetFont($font,
'',
'',
false);
25782 $this->
SetFont($prevFontFamily, $prevFontStyle, $prevFontSizePt,
false);
25790 foreach ($u as $char) {
25791 if ($this->_charDefined(
$cw, $char) || $char > 131071) {
25799 $patt = mb_substr($writehtml_e, $start, $l);
25800 if (preg_match(
"/(.*?)(" . preg_quote($patt,
'/') .
")(.*)/u", $writehtml_e, $m)) {
25801 $writehtml_e = $m[1];
25802 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'span style="font-family: ' . $font .
'"', $m[2],
'/span', $m[3]]);
25803 $this->subPos = $writehtml_i + 3;
25810 if (isset($this->backupSIPFont) && $this->backupSIPFont) {
25812 if ($this->currentfontfamily != $this->backupSIPFont) {
25813 $font = $this->backupSIPFont;
25822 if (isset($this->fonts[$font])) {
25823 $cw = &$this->fonts[$font][
'cw'];
25824 } elseif ($this->fontCache->has($font .
'.cw.dat')) {
25825 $cw = $this->fontCache->load($font .
'.cw.dat');
25827 $prevFontFamily = $this->FontFamily;
25828 $prevFontStyle = $this->currentfontstyle;
25829 $prevFontSizePt = $this->FontSizePt;
25830 $this->
SetFont($this->backupSIPFont,
'',
'',
false);
25831 $this->
SetFont($prevFontFamily, $prevFontStyle, $prevFontSizePt,
false);
25839 foreach ($u as $char) {
25840 if ($this->_charDefined(
$cw, $char) || $char > 131071) {
25848 $patt = mb_substr($writehtml_e, $start, $l);
25849 if (preg_match(
"/(.*?)(" . preg_quote($patt,
'/') .
")(.*)/u", $writehtml_e, $m)) {
25850 $writehtml_e = $m[1];
25851 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'span style="font-family: ' . $font .
'"', $m[2],
'/span', $m[3]]);
25852 $this->subPos = $writehtml_i + 3;
25862 if (!$this->PDFA && !$this->PDFX && !$this->biDirectional) {
25864 if (!$this->subArrMB) {
25865 require __DIR__ .
'/../data/subs_core.php';
25866 $this->subArrMB[
'a'] =
$aarr;
25867 $this->subArrMB[
's'] =
$sarr;
25868 $this->subArrMB[
'z'] =
$zarr;
25870 if (isset($this->subArrMB[
'a'][$u[0]])) {
25873 foreach ($u as $char) {
25874 if (isset($this->subArrMB[
'a'][$char])) {
25875 $repl[] = $this->subArrMB[
'a'][$char];
25880 } elseif (isset($this->subArrMB[
'z'][$u[0]])) {
25883 foreach ($u as $char) {
25884 if (isset($this->subArrMB[
'z'][$char])) {
25885 $repl[] = $this->subArrMB[
'z'][$char];
25890 } elseif (isset($this->subArrMB[
's'][$u[0]])) {
25893 foreach ($u as $char) {
25894 if (isset($this->subArrMB[
's'][$char])) {
25895 $repl[] = $this->subArrMB[
's'][$char];
25901 if ($ftype ==
'C') {
25902 $patt = mb_substr($writehtml_e, $start, count($repl));
25903 if (preg_match(
"/(.*?)(" . preg_quote($patt,
'/') .
")(.*)/u", $writehtml_e, $m)) {
25904 $writehtml_e = $m[1];
25905 array_splice($writehtml_a, $writehtml_i + 1, 0, [$font, implode(
'|', $repl),
'/' . $font, $m[3]]);
25906 $this->subPos = $writehtml_i + 3;
25914 if (!is_array($this->backupSubsFont)) {
25915 $this->backupSubsFont = [
"$this->backupSubsFont"];
25918 foreach ($this->backupSubsFont as $bsfctr => $bsf) {
25919 if ($this->currentfontfamily != $bsf) {
25928 if (isset($this->fonts[$font])) {
25929 $cw = &$this->fonts[$font][
'cw'];
25930 } elseif ($this->fontCache->has($font .
'.cw.dat')) {
25931 $cw = $this->fontCache->load($font .
'.cw.dat');
25933 $prevFontFamily = $this->FontFamily;
25934 $prevFontStyle = $this->currentfontstyle;
25935 $prevFontSizePt = $this->FontSizePt;
25936 $this->
SetFont($bsf,
'',
'',
false);
25937 $this->
SetFont($prevFontFamily, $prevFontStyle, $prevFontSizePt,
false);
25938 if ($this->fontCache->has($font .
'.cw.dat')) {
25939 $cw = $this->fontCache->load($font .
'.cw.dat');
25948 foreach ($u as $char) {
25949 if ($char == 173 || $this->_charDefined(
$cw, $char) || ($char > 1536 && $char < 1791) || ($char > 2304 && $char < 3455 )) {
25952 if ($l == 0 && $bsfctr == (count($this->backupSubsFont) - 1)) {
25953 $cont = mb_substr($writehtml_e, $start + 1);
25954 $writehtml_e = mb_substr($writehtml_e, 0, $start + 1);
25955 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'', $cont]);
25956 $this->subPos = $writehtml_i + 1;
25965 $patt = mb_substr($writehtml_e, $start, $l);
25966 if (preg_match(
"/(.*?)(" . preg_quote($patt,
'/') .
")(.*)/u", $writehtml_e, $m)) {
25967 $writehtml_e = $m[1];
25968 array_splice($writehtml_a, $writehtml_i + 1, 0, [
'span style="font-family: ' . $font .
'"', $m[2],
'/span', $m[3]]);
25969 $this->subPos = $writehtml_i + 3;
25982 $entarr = include __DIR__ .
'/../data/entity_substitutions.php';
25984 foreach ($entarr as $key => $val) {
25985 $this->entsearch[] =
'&' . $key .
';';
25994 if (count($this->entsearch)) {
25995 $html = str_replace($this->entsearch, $this->entsubstitute,
$html);
26006 if ($string === mb_convert_encoding(mb_convert_encoding($string,
"UTF-32",
"UTF-8"),
"UTF-8",
"UTF-32")) {
26010 if ($this->ignore_invalid_utf8) {
26011 $string = mb_convert_encoding(mb_convert_encoding($string,
"UTF-32",
"UTF-8"),
"UTF-8",
"UTF-32");
26028 if (!$this->is_utf8(
$html)) {
26030 while (mb_convert_encoding(mb_convert_encoding(
$html,
"UTF-32",
"UTF-8"),
"UTF-8",
"UTF-32") !=
$html) {
26032 $a = @iconv(
'UTF-8',
'UTF-8',
$html);
26033 $error = error_get_last();
26034 if ($error && $error[
'message'] ===
'iconv(): Detected an illegal character in input string') {
26035 throw new \Mpdf\MpdfException(
'Invalid input characters. Did you set $mpdf->in_charset properly?');
26038 $pos = $start = strlen($a);
26040 while (ord(substr(
$html, $pos, 1)) > 128) {
26041 $err .=
'[[#' . ord(substr(
$html, $pos, 1)) .
']]';
26045 $this->logger->error($err, [
'context' => LogContext::UTF8]);
26049 throw new \Mpdf\MpdfException(
"HTML contains invalid UTF-8 character(s). See log for further details");
26071 if (!$this->is_utf8($txt)) {
26072 throw new \Mpdf\MpdfException(
"Text contains invalid UTF-8 character(s)");
26075 $txt = preg_replace(
"/\r/",
"", $txt);
26084 $txt = $this->SubstituteHiEntities($txt);
26089 $txt = $this->lesser_entity_decode($txt);
26100 function WriteBarcode($code, $showtext = 1, $x =
'', $y =
'', $size = 1, $border = 0, $paddingL = 1, $paddingR = 1, $paddingT = 2, $paddingB = 2, $height = 1, $bgcol =
false, $col =
false, $btype =
'ISBN', $supplement =
'0', $supplement_code =
'', $k = 1)
26102 if (empty($code)) {
26107 $code = preg_replace(
'/\-/',
'', $code);
26109 $this->barcode =
new Barcode();
26110 if ($btype ==
'ISSN' || $btype ==
'ISBN') {
26111 $arrcode = $this->barcode->getBarcodeArray($code,
'EAN13');
26113 $arrcode = $this->barcode->getBarcodeArray($code, $btype);
26116 if ($arrcode ===
false) {
26117 throw new \Mpdf\MpdfException(
'Error in barcode string: ' . $codestr);
26120 if ((($btype ===
'EAN13' || $btype ===
'ISBN' || $btype ===
'ISSN') && strlen($code) === 12)
26121 || ($btype ==
'UPCA' && strlen($code) === 11)
26122 || ($btype ==
'UPCE' && strlen($code) === 11)
26123 || ($btype ==
'EAN8' && strlen($code) === 7)) {
26125 $code .= $arrcode[
'checkdigit'];
26127 if (stristr($codestr,
'-')) {
26128 $codestr .=
'-' . $arrcode[
'checkdigit'];
26130 $codestr .= $arrcode[
'checkdigit'];
26134 if ($btype ===
'ISBN') {
26135 $codestr =
'ISBN ' . $codestr;
26138 if ($btype ===
'ISSN') {
26139 $codestr =
'ISSN ' . $codestr;
26151 $prevDrawColor = $this->DrawColor;
26152 $prevTextColor = $this->TextColor;
26153 $prevFillColor = $this->FillColor;
26155 $lw = $this->LineWidth;
26160 $xres = $arrcode[
'nom-X'] * $size;
26161 $llm = $arrcode[
'lightmL'] * $arrcode[
'nom-X'] * $size;
26162 $rlm = $arrcode[
'lightmR'] * $arrcode[
'nom-X'] * $size;
26164 $bcw = ($arrcode[
"maxw"] * $xres);
26166 $fbw = $bcw + $llm + $rlm;
26167 $ow = $fbw + $paddingL + $paddingR;
26171 $num_height = 3 * $size;
26172 $fbh = $arrcode[
'nom-H'] * $size * $height;
26173 $bch = $fbh - (1.5 * $size);
26175 if (($btype ==
'EAN13' && $showtext) || $btype ==
'ISSN' || $btype ==
'ISBN') {
26176 $tisbnm = 1.5 * $size;
26177 $codestr_fontsize = 2.1 * $size;
26178 $paddingT += $codestr_fontsize + $tisbnm;
26181 $oh = $fbh + $paddingT + $paddingB;
26188 $this->SetDColor($col);
26189 $this->SetTColor($col);
26191 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26192 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26196 $this->SetFColor($bgcol);
26198 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
26201 if (!$bgcol && !$col) {
26209 $this->Rect($xpos, $ypos, $ow, $oh, $fillb);
26214 $xpos = $x + $paddingL + $llm;
26215 $ypos = $y + $paddingT;
26218 $this->SetFColor($col);
26220 $this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26223 if ($arrcode !==
false) {
26224 foreach ($arrcode[
"bcode"] as $v) {
26225 $bw = ($v[
"w"] * $xres);
26228 $this->Rect($xpos, $ypos, $bw, $bch,
'F');
26235 $prevFontFamily = $this->FontFamily;
26236 $prevFontStyle = $this->FontStyle;
26237 $prevFontSizePt = $this->FontSizePt;
26240 if (($btype ===
'EAN13' && $showtext) || $btype ===
'ISBN' || $btype ===
'ISSN') {
26242 if ($this->onlyCoreFonts) {
26243 $this->
SetFont(
'chelvetica');
26249 $this->SetFColor($bgcol);
26251 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
26254 $this->x = $x + $paddingL + 1;
26258 while ($loop == 0) {
26259 $this->
SetFontSize($codestr_fontsize * 1.4 * Mpdf::SCALE,
false);
26260 $sz = $this->GetStringWidth($codestr);
26263 $codestr_fontsize -= 0.1;
26269 $this->
SetFont(
'',
'', $codestr_fontsize * 1.4 * Mpdf::SCALE,
true,
true);
26272 $xtra = $fbwi - $sz;
26273 $charspacing = $xtra / (strlen($codestr) - 1);
26274 if ($charspacing) {
26275 $this->writer->write(sprintf(
'BT %.3F Tc ET', $charspacing * Mpdf::SCALE));
26279 $this->y = $y + $paddingT - ($codestr_fontsize ) - $tisbnm;
26280 $this->Cell($fbw, $codestr_fontsize, $codestr);
26282 if ($charspacing) {
26283 $this->writer->write(
'BT 0 Tc ET');
26290 if ($this->onlyCoreFonts) {
26300 if ($btype ===
'EAN13' || $btype ===
'ISBN' || $btype ===
'ISSN') {
26302 $outerfontsize = 3;
26303 $outerp = $xres * 4;
26304 $innerp = $xres * 2.5;
26305 $textw = ($bcw * 0.5) - $outerp - $innerp;
26307 $charLO = substr($code, 0, 1);
26308 $charLI = substr($code, 1, 6);
26309 $charRI = substr($code, 7, 6);
26311 if (!$supplement) {
26315 } elseif ($btype ===
'UPCA') {
26317 $outerfontsize = 2.3;
26318 $outerp = $xres * 10;
26319 $innerp = $xres * 2.5;
26320 $textw = ($bcw * 0.5) - $outerp - $innerp;
26322 $charLO = substr($code, 0, 1);
26323 $charLI = substr($code, 1, 5);
26324 $charRI = substr($code, 6, 5);
26325 $charRO = substr($code, 11, 1);
26327 } elseif ($btype ===
'UPCE') {
26329 $outerfontsize = 2.3;
26330 $outerp = $xres * 4;
26332 $textw = ($bcw * 0.5) - $outerp - $innerp;
26334 $upce_code = $arrcode[
'code'];
26335 $charLO = substr($code, 0, 1);
26336 $charLI = substr($upce_code, 0, 3);
26337 $charRI = substr($upce_code, 3, 3);
26338 $charRO = substr($code, 11, 1);
26340 } elseif ($btype ===
'EAN8') {
26342 $outerfontsize = 3;
26343 $outerp = $xres * 4;
26344 $innerp = $xres * 2.5;
26345 $textw = ($bcw * 0.5) - $outerp - $innerp;
26348 $charLI = substr($code, 0, 4);
26349 $charRI = substr($code, 4, 4);
26351 if (!$supplement) {
26356 $this->
SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE);
26358 if (!$this->usingCoreFont) {
26359 $cw = $this->_getCharWidth($this->CurrentFont[
'cw'], 32) * 3 * $fh * $size / 1000;
26361 $cw = 600 * 3 * $fh * $size / 1000;
26365 $y_text = $y + $paddingT + $bch - ($num_height / 2);
26366 $y_text_outer = $y + $paddingT + $bch - ($num_height * ($outerfontsize / 3) / 2);
26368 $this->x = $x + $paddingL - (
$cw * ($outerfontsize / 3) * 0.1);
26369 $this->y = $y_text_outer;
26370 $this->Cell(
$cw, $num_height, $charLO);
26373 $xtra = $textw - (
$cw * $chars);
26374 $charspacing = $xtra / ($chars - 1);
26375 if ($charspacing) {
26376 $this->writer->write(sprintf(
'BT %.3F Tc ET', $charspacing * Mpdf::SCALE));
26380 $this->SetFColor($bgcol);
26382 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
26385 $this->
SetFontSize(3 * $fh * $size * Mpdf::SCALE);
26388 $this->x = $x + $paddingL + $llm + $outerp;
26389 $this->y = $y_text;
26390 $this->Cell($textw, $num_height, $charLI, 0, 0,
'', 1);
26393 $this->x = $x + $paddingL + $llm + ($bcw * 0.5) + $innerp;
26394 $this->y = $y_text;
26395 $this->Cell($textw, $num_height, $charRI, 0, 0,
'', 1);
26397 if ($charspacing) {
26398 $this->writer->write(
'BT 0 Tc ET');
26402 $this->
SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE);
26404 $this->x = $x + $paddingL + $llm + $bcw + $rlm - (
$cw * ($outerfontsize / 3) * 0.9);
26405 $this->y = $y_text_outer;
26406 $this->Cell(
$cw * ($outerfontsize / 3), $num_height, $charRO, 0, 0,
'R');
26410 $supparrcode = $this->barcode->getBarcodeArray($supplement_code,
'EAN' . $supplement);
26412 if ($supparrcode ===
false) {
26413 throw new \Mpdf\MpdfException(
'Error in barcode string (supplement): ' . $codestr .
' ' . $supplement_code);
26416 if (strlen($supplement_code) != $supplement) {
26417 throw new \Mpdf\MpdfException(
'Barcode supplement incorrect: ' . $supplement_code);
26420 $llm = $fbw - (($arrcode[
'lightmR'] - $supparrcode[
'sepM']) * $arrcode[
'nom-X'] * $size);
26421 $rlm = $arrcode[
'lightmR'] * $arrcode[
'nom-X'] * $size;
26423 $bcw = ($supparrcode[
"maxw"] * $xres);
26425 $fbw = $bcw + $llm + $rlm;
26426 $ow = $fbw + $paddingL + $paddingR;
26427 $bch = $fbh - (1.5 * $size) - ($num_height + 0.5);
26429 $xpos = $x + $paddingL + $llm;
26430 $ypos = $y + $paddingT + $num_height + 0.5;
26433 $this->SetFColor($col);
26435 $this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26438 if ($supparrcode !==
false) {
26439 foreach ($supparrcode[
"bcode"] as $v) {
26440 $bw = ($v[
"w"] * $xres);
26443 $this->Rect($xpos, $ypos, $bw, $bch,
'F');
26451 $this->SetFColor($bgcol);
26453 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
26456 $this->
SetFontSize(3 * $fh * $size * Mpdf::SCALE);
26457 $this->x = $x + $paddingL + $llm;
26458 $this->y = $y + $paddingT;
26459 $this->Cell($bcw, $num_height, $supplement_code, 0, 0,
'C');
26462 $this->
SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE);
26463 $this->x = $x + $paddingL + $llm + $bcw + $rlm - (
$cw * 0.9);
26464 $this->y = $y + $paddingT;
26465 $this->Cell(
$cw * ($outerfontsize / 3), $num_height,
'>', 0, 0,
'R');
26469 $this->
SetFont($prevFontFamily, $prevFontStyle, $prevFontSizePt);
26470 $this->DrawColor = $prevDrawColor;
26471 $this->TextColor = $prevTextColor;
26472 $this->FillColor = $prevFillColor;
26480 function WriteBarcode2($code, $x =
'', $y =
'', $size = 1, $height = 1, $bgcol =
false, $col =
false, $btype =
'IMB', $print_ratio =
'', $k = 1, $quiet_zone_left =
null, $quiet_zone_right =
null)
26482 if (empty($code)) {
26486 $this->barcode =
new Barcode();
26487 $arrcode = $this->barcode->getBarcodeArray($code, $btype, $print_ratio, $quiet_zone_left, $quiet_zone_right);
26497 $prevDrawColor = $this->DrawColor;
26498 $prevTextColor = $this->TextColor;
26499 $prevFillColor = $this->FillColor;
26500 $lw = $this->LineWidth;
26503 $xres = $arrcode[
'nom-X'] * $size;
26505 if ($btype ===
'IMB' || $btype ===
'RM4SCC' || $btype ===
'KIX' || $btype ===
'POSTNET' || $btype ===
'PLANET') {
26506 $llm = $arrcode[
'quietL'] / $k;
26507 $rlm = $arrcode[
'quietR'] / $k;
26508 $tlm = $blm = $arrcode[
'quietTB'] / $k;
26510 } elseif (in_array($btype, [
'C128A',
'C128B',
'C128C',
'C128RAW',
'EAN128A',
'EAN128B',
'EAN128C',
'C39',
'C39+',
'C39E',
'C39E+',
'S25',
'S25+',
'I25',
'I25+',
'I25B',
'I25B+',
'C93',
'MSI',
'MSI+',
'CODABAR',
'CODE11'])) {
26511 $llm = $arrcode[
'lightmL'] * $xres;
26512 $rlm = $arrcode[
'lightmR'] * $xres;
26513 $tlm = $blm = $arrcode[
'lightTB'] * $xres * $height;
26516 $bcw = ($arrcode[
"maxw"] * $xres);
26517 $fbw = $bcw + $llm + $rlm;
26519 $bch = ($arrcode[
"nom-H"] * $size * $height);
26520 $fbh = $bch + $tlm + $blm;
26527 $this->SetDColor($col);
26528 $this->SetTColor($col);
26530 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26531 $this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26535 $this->SetFColor($bgcol);
26537 $this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
26542 $this->SetFColor($col);
26544 $this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
26548 if ($arrcode !==
false) {
26549 foreach ($arrcode[
"bcode"] as $v) {
26550 $bw = ($v[
"w"] * $xres);
26552 $ypos = $y + $tlm + ($bch * $v[
'p'] / $arrcode[
'maxh']);
26553 $this->Rect($xpos, $ypos, $bw, ($v[
'h'] * $bch / $arrcode[
'maxh']),
'F');
26560 if ($btype ==
'I25B' || $btype ==
'I25B+') {
26561 $this->Rect($x, $y, $fbw, ($arrcode[
'lightTB'] * $xres * $height),
'F');
26562 $this->Rect($x, $y + $tlm + $bch, $fbw, ($arrcode[
'lightTB'] * $xres * $height),
'F');
26566 $this->DrawColor = $prevDrawColor;
26567 $this->TextColor = $prevTextColor;
26568 $this->FillColor = $prevFillColor;
26576 if ($returnstring) {
26579 $this->writer->write(
'q');
26585 if ($returnstring) {
26588 $this->writer->write(
'Q');
26602 if (($s_x == 0) or ( $s_y == 0)) {
26603 throw new \Mpdf\MpdfException(
'Please do not use values equal to zero for scaling');
26606 $y = ($this->h - $y) * Mpdf::SCALE;
26617 $tm[4] = $x * (1 - $s_x);
26618 $tm[5] = $y * (1 - $s_y);
26621 if ($returnstring) {
26622 return($this->_transform($tm,
true));
26624 $this->_transform($tm);
26636 $tm[4] = $t_x * Mpdf::SCALE;
26637 $tm[5] = -$t_y * Mpdf::SCALE;
26640 if ($returnstring) {
26641 return($this->_transform($tm,
true));
26643 $this->_transform($tm);
26658 $y = ($this->h - $y) * Mpdf::SCALE;
26663 $tm[0] = cos(deg2rad($angle));
26664 $tm[1] = sin(deg2rad($angle));
26667 $tm[4] = $x + $tm[1] * $y - $tm[0] * $x;
26668 $tm[5] = $y - $tm[0] * $y - $tm[1] * $x;
26671 if ($returnstring) {
26672 return $this->_transform($tm,
true);
26674 $this->_transform($tm);
26691 $angle_x = -$angle_x;
26692 $angle_y = -$angle_y;
26695 $y = ($this->h - $y) * Mpdf::SCALE;
26700 $tm[1] = tan(deg2rad($angle_y));
26701 $tm[2] = tan(deg2rad($angle_x));
26703 $tm[4] = -$tm[2] * $y;
26704 $tm[5] = -$tm[1] * $x;
26707 if ($returnstring) {
26708 return $this->_transform($tm,
true);
26710 $this->_transform($tm);
26716 if ($returnstring) {
26717 return(sprintf(
'%.4F %.4F %.4F %.4F %.4F %.4F cm', $tm[0], $tm[1], $tm[2], $tm[3], $tm[4], $tm[5]));
26719 $this->writer->write(sprintf(
'%.4F %.4F %.4F %.4F %.4F %.4F cm', $tm[0], $tm[1], $tm[2], $tm[3], $tm[4], $tm[5]));
26726 if ($this->onlyCoreFonts) {
26731 $a = preg_split(
'/<(.*?)>/ms',
$html, -1, PREG_SPLIT_DELIM_CAPTURE);
26732 foreach ($a as $i => $e) {
26736 if ($i > 0 && strtolower(substr($a[$i - 1], 1, 8)) ==
'textarea') {
26742 $e = $this->lesser_entity_decode($e);
26744 $earr = $this->UTF8StringToArray($e,
false);
26747 $scriptblocks = [];
26748 $scriptblocks[0] = 0;
26753 foreach ($earr as $char) {
26756 $sbl = $ucd_record[6];
26758 if ($sbl && $sbl != 40 && $sbl != 102) {
26759 if ($scriptblock == 0) {
26760 $scriptblock = $sbl;
26761 $scriptblocks[$subchunk] = $scriptblock;
26762 } elseif ($scriptblock > 0 && $scriptblock != $sbl) {
26766 $scriptblock = $sbl;
26768 $scriptblocks[$subchunk] = $scriptblock;
26772 $chardata[$subchunk][$charctr][
'script'] = $sbl;
26773 $chardata[$subchunk][$charctr][
'uni'] = $char;
26780 for ($sch = 0; $sch < $subchunk; $sch++) {
26781 if ($scriptblocks[$sch] > 0 && $scriptblocks[$sch] != $this->baseScript && $scriptblocks[$sch + 1] == $this->baseScript) {
26782 $end = count($chardata[$sch]) - 1;
26783 while ($chardata[$sch][$end][
'script'] == 0 && $end > 1) {
26784 $tmp = array_pop($chardata[$sch]);
26785 array_unshift($chardata[$sch + 1], $tmp);
26792 for ($sch = 0; $sch <= $subchunk; $sch++) {
26794 if (isset($chardata[$sch])) {
26796 for ($j = 0; $j < count($chardata[$sch]); $j++) {
26801 $s = str_replace(
"&",
"&", $s);
26802 $s = str_replace(
"<",
"<", $s);
26803 $s = str_replace(
">",
">", $s);
26806 if ($scriptblocks[$sch] ==
Ucdn::SCRIPT_LATIN && $this->autoVietnamese && preg_match(
"/([" . $this->scriptToLanguage->getLanguageDelimiters(
'viet') .
"])/u", $s)) {
26807 $o .=
'<span lang="vi" class="lang_vi">' . $s .
'</span>';
26809 if (preg_match(
"/[" . $this->scriptToLanguage->getLanguageDelimiters(
'sindhi') .
"]/u", $s)) {
26810 $o .=
'<span lang="sd" class="lang_sd">' . $s .
'</span>';
26811 } elseif (preg_match(
"/[" . $this->scriptToLanguage->getLanguageDelimiters(
'urdu') .
"]/u", $s)) {
26812 $o .=
'<span lang="ur" class="lang_ur">' . $s .
'</span>';
26813 } elseif (preg_match(
"/[" . $this->scriptToLanguage->getLanguageDelimiters(
'pashto') .
"]/u", $s)) {
26814 $o .=
'<span lang="ps" class="lang_ps">' . $s .
'</span>';
26815 } elseif (preg_match(
"/[" . $this->scriptToLanguage->getLanguageDelimiters(
'persian') .
"]/u", $s)) {
26816 $o .=
'<span lang="fa" class="lang_fa">' . $s .
'</span>';
26817 } elseif ($this->baseScript !=
Ucdn::SCRIPT_ARABIC && $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch])) {
26818 $o .=
'<span lang="' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) .
'" class="lang_' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) .
'">' . $s .
'</span>';
26823 } elseif ($scriptblocks[$sch] > 0 && $scriptblocks[$sch] != $this->baseScript && $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch])) {
26825 $o .=
'<span lang="' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) .
'" class="lang_' . $this->scriptToLanguage->getLanguageByScript($scriptblocks[$sch]) .
'">';
26837 $a[$i] =
'<' . $e .
'>';
26841 $n = implode(
'', $a);
26852 if ($type ===
'Td') {
26854 $a += ($xadj * $k);
26855 $b -= ($yadj * $k);
26857 return 'BT ' . sprintf(
'%.3F %.3F', $a, $b) .
' Td';
26859 } elseif ($type ===
're') {
26861 $a += ($xadj * $k);
26862 $b -= ($yadj * $k);
26864 return sprintf(
'%.3F %.3F %.3F %.3F', $a, $b, $c, $d) .
' re';
26866 } elseif ($type ===
'l') {
26868 $a += ($xadj * $k);
26869 $b -= ($yadj * $k);
26871 return sprintf(
'%.3F %.3F l', $a, $b);
26873 } elseif ($type ===
'img') {
26875 $c += ($xadj * $k);
26876 $d -= ($yadj * $k);
26878 return sprintf(
'q %.3F 0 0 %.3F %.3F %.3F', $a, $b, $c, $d) .
' cm /' . $e;
26880 } elseif ($type ===
'draw') {
26882 $a += ($xadj * $k);
26883 $b -= ($yadj * $k);
26885 return sprintf(
'%.3F %.3F m', $a, $b);
26887 } elseif ($type ===
'bezier') {
26889 $a += ($xadj * $k);
26890 $b -= ($yadj * $k);
26891 $c += ($xadj * $k);
26892 $d -= ($yadj * $k);
26893 $e += ($xadj * $k);
26894 $f -= ($yadj * $k);
26896 return sprintf(
'%.3F %.3F %.3F %.3F %.3F %.3F', $a, $b, $c, $d, $e, $f) .
' c';
26905 if (preg_match(
'/([\-]*[0-9\.]+)(deg|grad|rad)/i', $s, $m)) {
26907 $angle = $m[1] + 0;
26909 if (strtolower($m[2]) ==
'deg') {
26911 } elseif (strtolower($m[2]) ==
'grad') {
26912 $angle *= (360 / 400);
26913 } elseif (strtolower($m[2]) ==
'rad') {
26914 $angle = rad2deg($angle);
26917 while ($angle >= 360) {
26921 while ($angle <= -360) {
26925 if ($makepositive) {
26953 $limit = ini_get(
'pcre.backtrack_limit');
26955 if (0 >= (
int) $limit) {
26956 throw new \Mpdf\MpdfException(sprintf(
26957 'mPDF will not process HTML with disabled pcre.backtrack_limit to prevent unexpected behaviours, please set a positive backtrack limit.',
26962 if (strlen(
$html) > (
int) $limit) {
26963 throw new \Mpdf\MpdfException(sprintf(
26964 'The HTML code size is larger than pcre.backtrack_limit %d. You should use WriteHTML() with smaller string lengths.',
26969 preg_match_all(
"/(<annotation.*?>)/si",
$html, $m);
26970 if (count($m[1])) {
26971 for ($i = 0; $i < count($m[1]); $i++) {
26972 $sub = preg_replace(
"/\n/si",
"\xbb\xa4\xac", $m[1][$i]);
26973 $html = preg_replace(
'/' . preg_quote($m[1][$i],
'/') .
'/si', $sub,
$html);
26977 preg_match_all(
"/(<svg.*?<\/svg>)/si",
$html, $svgi);
26978 if (count($svgi[0])) {
26979 for ($i = 0; $i < count($svgi[0]); $i++) {
26980 $file = $this->cache->write(
'/_tempSVG' . uniqid(random_int(1, 100000),
true) .
'_' . $i .
'.svg', $svgi[0][$i]);
26981 $html = str_replace($svgi[0][$i],
'<img src="' . $file .
'" />',
$html);
26986 $html = preg_replace(
'/<script.*?<\/script>/is',
'',
$html);
26989 $html = preg_replace(
'/<!--mpdf/i',
'',
$html);
26990 $html = preg_replace(
'/mpdf-->/i',
'',
$html);
26993 $html = preg_replace(
'/<!--.*?-->/s',
'',
$html);
26999 $html = preg_replace(
'/<(br|hr)>/i',
"<\\1 />",
$html);
27000 $html = preg_replace(
'/<(br|hr)\/>/i',
"<\\1 />",
$html);
27003 $html = preg_replace(
'/<tr>\s*<\/tr>/i',
'',
$html);
27004 $html = preg_replace(
'/<thead>\s*<\/thead>/i',
'',
$html);
27005 $html = preg_replace(
'/<tfoot>\s*<\/tfoot>/i',
'',
$html);
27006 $html = preg_replace(
'/<table[^>]*>\s*<\/table>/i',
'',
$html);
27009 $html = preg_replace(
"/[ \n\r]+<\/t(d|h)/",
'</t\\1',
$html);
27011 $html = preg_replace(
"/[ ]*<dottab\s*[\/]*>[ ]*/",
'<dottab />',
$html);
27014 $html = str_replace(
'</tts><tts>',
'|',
$html);
27015 $html = str_replace(
'</ttz><ttz>',
'|',
$html);
27016 $html = str_replace(
'</tta><tta>',
'|',
$html);
27018 $html = preg_replace(
'/<br \/>\s*/is',
"<br />",
$html);
27020 $html = preg_replace(
'/<wbr[ \/]*>\s*/is',
"­",
$html);
27023 if (preg_match(
'/<pre/',
$html)) {
27025 $html_a = preg_split(
'/(<\/?pre[^>]*>)/',
$html, -1, 2);
27029 foreach ($html_a as $s) {
27030 if ($c > 1 && preg_match(
'/^<\/pre/i', $s)) {
27032 $s = preg_replace(
'/<\/pre/i',
'</innerpre', $s);
27033 } elseif ($c > 0 && preg_match(
'/^<pre/i', $s)) {
27035 $s = preg_replace(
'/<pre/i',
'<innerpre', $s);
27036 } elseif (preg_match(
'/^<pre/i', $s)) {
27038 } elseif (preg_match(
'/^<\/pre/i', $s)) {
27041 array_push($h, $s);
27044 $html = implode(
'', $h);
27047 $thereispre = preg_match_all(
'#<pre(.*?)>(.*?)</pre>#si',
$html, $temp);
27050 $thereistextarea = preg_match_all(
'#<textarea(.*?)>(.*?)</textarea>#si',
$html, $temp2);
27055 $html = preg_replace(
'/<([^!\/a-zA-Z_:])/i',
'<\\1',
$html);
27058 $html = preg_replace(
'/\/li>\s+<\/(u|o)l/i',
'/li></\\1l',
$html);
27059 $html = preg_replace(
'/\/(u|o)l>\s+<\/li/i',
'/\\1l></li',
$html);
27060 $html = preg_replace(
'/\/li>\s+<\/(u|o)l/i',
'/li></\\1l',
$html);
27061 $html = preg_replace(
'/\/li>\s+<li/i',
'/li><li',
$html);
27062 $html = preg_replace(
'/<(u|o)l([^>]*)>[ ]+/i',
'<\\1l\\2>',
$html);
27063 $html = preg_replace(
'/[ ]+<(u|o)l/i',
'<\\1l',
$html);
27067 $selftabs =
'input|hr|img|br|barcode|dottab';
27068 $selftabs2 =
'indexentry|indexinsert|bookmark|watermarktext|watermarkimage|column_break|columnbreak|newcolumn|newpage|page_break|pagebreak|formfeed|columns|toc|tocpagebreak|setpageheader|setpagefooter|sethtmlpageheader|sethtmlpagefooter|annotation';
27071 $html = preg_replace(
'/(<(' . $selftabs .
'|' . $selftabs2 .
')[^>\/]*)>/i',
'\\1 />',
$html);
27074 $html = preg_replace(
'/(<(' . $selftabs .
'|' . $selftabs2 .
'))\/>/i',
'\\1 />',
$html);
27077 while ($thereispre) {
27078 $temp[2][$iterator] = preg_replace(
'/<([^!\/a-zA-Z_:])/',
'<\\1', $temp[2][$iterator]);
27080 $temp[2][$iterator] = preg_replace_callback(
"/^([^\n\t]*?)\t/m", [$this,
'tabs2spaces_callback'], $temp[2][$iterator]);
27081 $temp[2][$iterator] = preg_replace(
'/\t/', str_repeat(
" ", $tabSpaces), $temp[2][$iterator]);
27083 $temp[2][$iterator] = preg_replace(
'/\n/',
"<br />", $temp[2][$iterator]);
27084 $temp[2][$iterator] = str_replace(
'\\',
"\\\\", $temp[2][$iterator]);
27086 $html = preg_replace(
'#<pre(.*?)>(.*?)</pre>#si',
'<erp' . $temp[1][$iterator] .
'>' . str_replace(
'$',
'\$', $temp[2][$iterator]) .
'</erp>',
$html, 1);
27092 while ($thereistextarea) {
27093 $temp2[2][$iterator] = preg_replace(
'/\t/', str_repeat(
" ", $tabSpaces), $temp2[2][$iterator]);
27094 $temp2[2][$iterator] = str_replace(
'\\',
"\\\\", $temp2[2][$iterator]);
27095 $html = preg_replace(
'#<textarea(.*?)>(.*?)</textarea>#si',
'<aeratxet' . $temp2[1][$iterator] .
'>' . trim($temp2[2][$iterator]) .
'</aeratxet>',
$html, 1);
27096 $thereistextarea--;
27102 $html = str_replace(
"</erp>",
"</pre>",
$html);
27103 $html = str_replace(
"<aeratxet",
"<textarea",
$html);
27104 $html = str_replace(
"</aeratxet>",
"</textarea>",
$html);
27105 $html = str_replace(
"</innerpre",
"</pre",
$html);
27106 $html = str_replace(
"<innerpre",
"<pre",
$html);
27108 $html = preg_replace(
'/<textarea([^>]*)><\/textarea>/si',
'<textarea\\1> </textarea>',
$html);
27109 $html = preg_replace(
'/(<table[^>]*>)\s*(<caption)(.*?<\/caption>)(.*?<\/table>)/si',
'\\2 position="top"\\3\\1\\4\\2 position="bottom"\\3',
$html);
27110 $html = preg_replace(
'/<(h[1-6])([^>]*)(>(?:(?!h[1-6]).)*?<\/\\1>\s*<table)/si',
'<\\1\\2 keep-with-table="1"\\3',
$html);
27111 $html = preg_replace(
"/\xbb\xa4\xac/",
"\n",
$html);
27114 $html = preg_replace(
"/(&#[x]{0,1}[0-9a-f]{1,5})</i",
"\\1;<",
$html);
27122 return (stripslashes($matches[1]) . str_repeat(
' ', $this->tabSpaces - (mb_strlen(stripslashes($matches[1])) % $this->tabSpaces)));
27128 return date($matches[1]);
27134 $pdf = file_get_contents($file_in);
27136 if (!is_array($search)) {
27140 if (!is_array($replacement)) {
27142 $replacement = [$x];
27145 if (!$this->onlyCoreFonts && !$this->usingCoreFont) {
27146 foreach ($search as $k => $val) {
27147 $search[$k] = $this->writer->utf8ToUtf16BigEndian($search[$k],
false);
27148 $search[$k] = $this->writer->escape($search[$k]);
27149 $replacement[$k] = $this->writer->utf8ToUtf16BigEndian($replacement[$k],
false);
27150 $replacement[$k] = $this->writer->escape($replacement[$k]);
27153 foreach ($replacement as $k => $val) {
27154 $replacement[$k] = mb_convert_encoding($replacement[$k], $this->mb_enc,
'utf-8');
27155 $replacement[$k] = $this->writer->escape($replacement[$k]);
27161 preg_match(
"/xref\n0 (\d+)\n(.*?)\ntrailer/s", $pdf, $m);
27162 $xref_objid = $m[1];
27163 preg_match_all(
'/(\d{10}) (\d{5}) (f|n)/', $m[2], $x);
27164 for ($i = 0; $i < count($x[0]); $i++) {
27165 $xref[] = [intval($x[1][$i]), $x[2][$i], $x[3][$i]];
27169 preg_match(
"/<<\s*\/Type\s*\/Pages\s*\/Kids\s*\[(.*?)\]\s*\/Count/s", $pdf, $m);
27170 preg_match_all(
"/(\d+) 0 R /s", $m[1], $o);
27173 foreach ($objlist as $obj) {
27174 if ($this->compress) {
27175 preg_match(
"/" . ($obj + 1) .
" 0 obj\n<<\s*\/Filter\s*\/FlateDecode\s*\/Length (\d+)>>\nstream\n(.*?)\nendstream\n/s", $pdf, $m);
27177 preg_match(
"/" . ($obj + 1) .
" 0 obj\n<<\s*\/Length (\d+)>>\nstream\n(.*?)\nendstream\n/s", $pdf, $m);
27187 if ($this->encrypted) {
27188 $s = $this->protection->rc4($this->protection->objectKey($obj + 1), $s);
27191 if ($this->compress) {
27192 $s = gzuncompress($s);
27195 foreach ($search as $k => $val) {
27196 $s = str_replace($search[$k], $replacement[$k], $s);
27199 if ($this->compress) {
27200 $s = gzcompress($s);
27203 if ($this->encrypted) {
27204 $s = $this->protection->rc4($this->protection->objectKey($obj + 1), $s);
27207 $newlen = strlen($s);
27209 $changes[($xref[$obj + 1][0])] = ($newlen - $oldlen) + (strlen($newlen) - strlen($oldlen));
27211 if ($this->compress) {
27212 $newstr = ($obj + 1) .
" 0 obj\n<</Filter /FlateDecode /Length " . $newlen .
">>\nstream\n" . $s .
"\nendstream\n";
27214 $newstr = ($obj + 1) .
" 0 obj\n<</Length " . $newlen .
">>\nstream\n" . $s .
"\nendstream\n";
27217 $pdf = str_replace($m[0], $newstr, $pdf);
27222 $newxref =
"xref\n0 " . $xref_objid .
"\n";
27223 foreach ($xref as $v) {
27224 foreach ($changes as $ck => $cv) {
27229 $newxref .= sprintf(
'%010d', $v[0]) .
' ' . $v[1] .
' ' . $v[2] .
" \n";
27231 $newxref .=
"trailer";
27232 $pdf = preg_replace(
"/xref\n0 \d+\n.*?\ntrailer/s", $newxref, $pdf);
27235 preg_match(
"/startxref\n(\d+)\n%%EOF/s", $pdf, $m);
27236 $startxref = $m[1];
27237 $startxref += array_sum($changes);
27238 $pdf = preg_replace(
"/startxref\n(\d+)\n%%EOF/s",
"startxref\n" . $startxref .
"\n%%EOF", $pdf);
27243 if (isset($_SERVER[
'SERVER_NAME'])) {
27245 header(
'Content-Type: application/pdf');
27246 header(
'Content-Length: ' . strlen($pdf));
27247 header(
'Content-disposition: inline; filename=' . $file_out);
27256 $file_out =
'mpdf.pdf';
27259 $f = fopen($file_out,
'wb');
27262 throw new \Mpdf\MpdfException(
'Unable to create output file: ' . $file_out);
27265 fwrite($f, $pdf, strlen($pdf));
27276 if (isset($_SERVER[
'HTTP_USER_AGENT']) and strpos($_SERVER[
'HTTP_USER_AGENT'],
'MSIE')) {
27277 header(
'Content-Type: application/force-download');
27279 header(
'Content-Type: application/octet-stream');
27282 header(
'Content-Length: ' . strlen($pdf));
27283 header(
'Content-disposition: attachment; filename=' . $file_out);
27295 $w = (($this->pgwidth + $spacing) / $npr) - $spacing;
27296 $oldlinewidth = $this->LineWidth;
27298 $this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
27301 $x = $_x = $this->lMargin;
27302 $_y = $this->tMargin;
27304 if ($this->y == 0) {
27312 for ($n = 1; $n <= $pagecount; $n++) {
27315 $this->Rect($x, $y, $size[
'width'], $size[
'height']);
27316 $h = max($h, $size[
'height']);
27317 $maxh = max($h, $maxh);
27319 if ($n % $npr == 0) {
27320 if (($y + $h + $spacing + $maxh) > $this->PageBreakTrigger && $n != $pagecount) {
27325 $y += $h + $spacing;
27330 $x += $w + $spacing;
27338 if (!isset($this->importedPages[$tplidx])) {
27339 $this->pageTemplate =
'';
27342 $this->pageTemplate = $tplidx;
27347 $this->docTemplate = $file;
27348 $this->docTemplateContinue = $continue;
27349 $this->docTemplateContinue2pages = $continue2pages;
27351 if ($this->docTemplateContinue2pages) {
27352 $this->docTemplateContinue = $this->docTemplateContinue2pages;
27361 $this->writer->object();
27362 $this->writer->write(
'<<');
27363 $this->writer->write(
'/S /JavaScript ');
27364 $this->writer->write(
'/JS ' . $this->writer->string($string));
27365 $this->writer->write(
'>>');
27366 $this->writer->write(
'endobj');
27371 $this->js = $script;
27383 $dotPos = strrpos($num,
'.');
27384 $commaPos = strrpos($num,
',');
27385 $sep = (($dotPos > $commaPos) && $dotPos) ? $dotPos : ((($commaPos > $dotPos) && $commaPos) ? $commaPos :
false);
27388 return floatval(preg_replace(
'/[^0-9]/',
'', $num));
27392 preg_replace(
'/[^0-9]/',
'', substr($num, 0, $sep)) .
'.' .
27393 preg_replace(
'/[^0-9]/',
'', substr($num, $sep+1, strlen($num)))
27399 return $this->fontDescriptor;
27407 $this->writer->write($s);
27420 $html = str_replace(
'{PAGENO}', $PAGENO,
$html);
27421 $html = str_replace($this->aliasNbPgGp, $NbPgGp,
$html);
27422 $html = str_replace($this->aliasNbPg, $NbPg,
$html);
27425 $html = str_replace(mb_convert_encoding(
'{PAGENO}',
'UTF-16BE',
'UTF-8'), mb_convert_encoding($PAGENO,
'UTF-16BE',
'UTF-8'),
$html);
27426 $html = str_replace(mb_convert_encoding($this->aliasNbPgGp,
'UTF-16BE',
'UTF-8'), mb_convert_encoding($NbPgGp,
'UTF-16BE',
'UTF-8'),
$html);
27427 $html = str_replace(mb_convert_encoding($this->aliasNbPg,
'UTF-16BE',
'UTF-8'), mb_convert_encoding($NbPg,
'UTF-16BE',
'UTF-8'),
$html);
27430 $html = preg_replace_callback(
'/\{DATE\s+(.*?)\}/', [$this,
'date_callback'],
$html);
$id
inisialisasi variabel yang menampung session value 'id'
const HTML_PARSE_NO_WRITE
AdjustHTML($html, $tabSpaces=8)
SetMargins($left, $right, $top)
Bookmark($txt, $level=0, $y=0)
AddSpotColorsFromFile($file)
SetDrawColor($r, $g=-1, $b=-1, $col4=-1, $return=false)
_setDashBorder($style, $div, $cp, $side)
UTF8StringToArray($str, $addSubset=true)
_computeLineheight($lh, $fs='')
SetAutoPageBreak($auto, $margin=0)
SetHTMLFooterByName($name, $side='O')
MultiCell( $w, $h, $txt, $border=0, $align='', $fill=0, $link='', $directionality='ltr', $encoded=false, $OTLdata=false, $maxrows=false)
SetTextColor($r, $g=-1, $b=-1, $col4=-1, $return=false)
SubstituteHiEntities($html)
ConvertAngle($s, $makepositive=true)
_tableWrite(&$table, $split=false, $startrow=0, $startcol=0, $splitpg=0, $rety=0)
SetPagedMediaCSS($name, $first, $oddEven)
Rect($x, $y, $w, $h, $style='')
PrintTableBackgrounds($adjustmenty=0)
SetDocTemplate($file='', $continue=0, $continue2pages=0)
MovePages($target_page, $start_page, $end_page=-1)
SetDash($black=false, $white=false)
$curlAllowUnsafeSslRequests
setCSS($arrayaux, $type='', $tag='')
_getListMarkerWidth(&$currblk, &$a, &$i)
applyGPOSpdf($txt, $aix, $x, $y, $OTLdata, $textvar=0)
SetColumns($NbCol, $vAlign='', $gap=5)
SetProtection($permissions=[], $user_pass='', $owner_pass=null, $length=40)
TableHeaderFooter($content='', $tablestartpage='', $tablestartcolumn='', $horf='H', $level=0, $firstSpread=true, $finalSpread=true)
_getPrevChar($contentctr, $charctr, $content)
SubstituteCharsNonCore(&$writehtml_a, &$writehtml_i, &$writehtml_e)
DefHeaderByName($name, $arr)
_resizeBackgroundImage($imw, $imh, $cw, $ch, $resize, $repx, $repy, $pba=[], $size=[])
_Arc($x1, $y1, $x2, $y2, $x3, $y3)
_tableGetHeight(&$table, $i, $j)
_getStyledNumber($ppgno, $type, $listmarker=false)
TOC_Entry($txt, $level=0, $toc_id=0)
TOCpagebreak($tocfont='', $tocfontsize='', $tocindent='', $TOCusePaging=true, $TOCuseLinking='', $toc_orientation='', $toc_mgl='', $toc_mgr='', $toc_mgt='', $toc_mgb='', $toc_mgh='', $toc_mgf='', $toc_ohname='', $toc_ehname='', $toc_ofname='', $toc_efname='', $toc_ohvalue=0, $toc_ehvalue=0, $toc_ofvalue=0, $toc_efvalue=0, $toc_preHTML='', $toc_postHTML='', $toc_bookmarkText='', $resetpagenum='', $pagenumstyle='', $suppress='', $orientation='', $mgl='', $mgr='', $mgt='', $mgb='', $mgh='', $mgf='', $ohname='', $ehname='', $ofname='', $efname='', $ohvalue=0, $ehvalue=0, $ofvalue=0, $efvalue=0, $toc_id=0, $pagesel='', $toc_pagesel='', $sheetsize='', $toc_sheetsize='', $tocoutdent='')
_saveCellTextBuffer($t, $link='', $intlink='')
$table_error_report_param
$default_lineheight_correction
_setPageSize($format, &$orientation)
printbuffer($arrayaux, $blockstate=0, $is_table=false, $table_draft=false, $cell_dir='')
_setClippingPath($clx, $cly, $clw, $clh)
ClearFloats($clear, $blklvl=0)
DivLn($h, $level=-3, $move_y=true, $collapsible=false, $state=0)
SetDefaultBodyCSS($prop, $val)
_tableGetWidth(&$table, $i, $j)
_getBorderWidths($bindata)
SetHTMLFooter($footer='', $OE='')
SetHeader($Harray=[], $side='', $write=false)
GetCharWidthNonCore($c, $addSubset=true)
$shrink_this_table_to_fit
AddSpotColor($name, $c, $m, $y, $k)
SubstituteCharsSIP(&$writehtml_a, &$writehtml_i, &$writehtml_e)
SetAssociatedFiles(array $files)
finishFlowingBlock($endofblock=false, $next='')
SetDisplayMode($zoom, $layout='continuous')
AddPage( $orientation='', $condition='', $resetpagenum='', $pagenumstyle='', $suppress='', $mgl='', $mgr='', $mgt='', $mgb='', $mgh='', $mgf='', $ohname='', $ehname='', $ofname='', $efname='', $ohvalue=0, $ehvalue=0, $ofvalue=0, $efvalue=0, $pagesel='', $newformat='')
setBorder(&$var, $flag, $set=true)
SetDirectionality($dir='ltr')
_splitTableGetWidth(&$table, $i, $j)
lesser_entity_decode($html)
DefHTMLHeaderByName($name, $html)
Circle($x, $y, $r, $style='S')
_shareHeaderFooterWidth($cl, $cc, $cr)
SetTextOutline($params=[])
SetPageTemplate($tplidx='')
_postForcedPagebreak($pagebreaktype, $startpage, $save_blk, $save_blklvl)
SetAlpha($alpha, $bm='Normal', $return=false, $mode='B')
WriteFixedPosHTML($html, $x, $y, $w, $h, $overflow='visible', $bounding=[])
SetFooter($Farray=[], $side='')
SetTColor($col, $return=false)
_setLineYpos(&$fontsize, &$fontdesc, &$CSSlineheight, $blockYpos=false)
$list_indent_default_mpdf
GetStringWidth($s, $addSubset=true, $OTLdata=false, $textvar=0, $includeKashida=false)
WriteBarcode2($code, $x='', $y='', $size=1, $height=1, $bgcol=false, $col=false, $btype='IMB', $print_ratio='', $k=1, $quiet_zone_left=null, $quiet_zone_right=null)
_set_object_javascript($string)
GetFloatDivInfo($blklvl=0, $clear=false)
magic_reverse_dir(&$chunk, $dir, &$chunkOTLdata)
SetHTMLHeader($header='', $OE='', $write=false)
WriteBarcode($code, $showtext=1, $x='', $y='', $size=1, $border=0, $paddingL=1, $paddingR=1, $paddingT=2, $paddingB=2, $height=1, $bgcol=false, $col=false, $btype='ISBN', $supplement='0', $supplement_code='', $k=1)
_preForcedPagebreak($pagebreaktype)
AddFontDirectory($directory)
TOC( $tocfont='', $tocfontsize=0, $tocindent=0, $resetpagenum='', $pagenumstyle='', $suppress='', $toc_orientation='', $TOCusePaging=true, $TOCuseLinking=false, $toc_id=0, $tocoutdent='')
$allow_html_optional_endtags
WriteFlowingBlock($s, $sOTLdata)
PrintPageBackgrounds($adjustmenty=0)
_beginpage( $orientation, $mgl='', $mgr='', $mgt='', $mgb='', $mgh='', $mgf='', $ohname='', $ehname='', $ofname='', $efname='', $ohvalue=0, $ehvalue=0, $ofvalue=0, $efvalue=0, $pagesel='', $newformat='')
$adjustFontDescLineheight
Thumbnail($file, $npr=3, $spacing=10)
_setInlineBlockHeights(&$lineBox, &$stackHeight, &$content, &$font, $is_table)
$docTemplateContinue2pages
transformSkew($angle_x, $angle_y, $x='', $y='', $returnstring=false)
transformTranslate($t_x, $t_y, $returnstring=false)
docPageNum($num=0, $extras=false)
aliasReplace($html, $PAGENO, $NbPgGp, $NbPg)
$useFixedNormalLineHeight
DeletePages($start_page, $end_page=-1)
setLogger(LoggerInterface $logger)
Arrow($x1, $y1, $x2, $y2, $headsize=3, $fill='B', $angle=25)
Link($x, $y, $w, $h, $link)
SetFontSize($size, $write=true)
SetLink($link, $y=0, $page=-1)
GetFullPath(&$path, $basepath='')
SetHTMLHeaderByName($name, $side='O', $write=false)
InsertIndex($usedivletters=1, $useLinking=false, $indexCollationLocale='', $indexCollationGroup='')
_transform($tm, $returnstring=false)
_moveToPrevChar(&$contentctr, &$charctr, $content)
_EllipseArc($x0, $y0, $rx, $ry, $seg=1, $part=false, $start=false)
SetDisplayPreferences($preferences)
AliasNbPageGroups($alias='{nbpg}')
SetDefaultFontSize($fontsize)
_unpackCellBorder($bindata)
_borderPadding($a, $b, &$px, &$py)
SubstituteCharsMB(&$writehtml_a, &$writehtml_i, &$writehtml_e)
docPageNumTotal($num=0, $extras=false)
restoreFont(&$saved, $write=true)
AddCIDFont($family, $style, $name, &$cw, $CMap, $registry, $desc)
_setAutoHeaderHeight(&$htmlh)
_kern($txt, $mode, $aix, $x, $y)
_tableRect($x, $y, $w, $h, $bord=-1, $details=[], $buffer=false, $bSeparate=false, $cort='cell', $tablecorner='', $bsv=0, $bsh=0)
DefFooterByName($name, $arr)
PaintImgBorder($objattr, $is_table)
newFlowingBlock($w, $h, $a='', $is_table=false, $blockstate=0, $newblock=true, $blockdir='ltr', $table_draft=false)
SetFont($family, $style='', $size=0, $write=true, $forcewrite=false)
RestrictUnicodeFonts($res)
SetHeaderByName($name, $side='O', $write=false)
_getNormalLineheight($desc=false)
_createHTMLheaderFooter($arr, $hf)
SetLineHeight($FontPt='', $lh='')
StartTransform($returnstring=false)
Output($name='', $dest='')
GetJspacing($nc, $ns, $w, $inclCursive, &$cOTLdata)
SetFillColor($r, $g=-1, $b=-1, $col4=-1, $return=false)
inlineObject($type, $x, $y, $objattr, $Lmargin, $widthUsed, $maxWidth, $lineHeight, $paint=false, $is_table=false)
TableCheckMinWidth($maxwidth, $forcewrap=0, $textbuffer=[], $checkletter=false)
_fixTableBorders(&$table)
Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $currentx=0, $lcpaddingL=0, $lcpaddingR=0, $valign='M', $spanfill=0, $exactWidth=false, $OTLdata=false, $textvar=0, $lineBox=false)
purify_utf8($html, $lo=true)
_setBidiCodes($mode='start', $bdf='')
_saveTextBuffer($t, $link='', $intlink='', $return=false)
SetFColor($col, $return=false)
$cellLineStackingStrategy
Text($x, $y, $txt, $OTLdata=[], $textvar=0, $aixextra='', $coordsys='', $return=false)
PaintDivLnBorder($state=0, $blvl=0, $h=0)
transformScale($s_x, $s_y, $x='', $y='', $returnstring=false)
watermark($texte, $angle=45, $fontsize=96, $alpha=0.2)
Annotation($text, $x=0, $y=0, $icon='Note', $author='', $subject='', $opacity=0, $colarray=false, $popup='', $file='')
AliasNbPages($alias='{nb}')
getBasicOTLdata(&$chunkOTLdata, $unicode, &$is_strong)
setHiEntitySubstitutions()
__construct(array $config=[])
transformRotate($angle, $x='', $y='', $returnstring=false)
_setListMarker($listitemtype, $listitemimage, $listitemposition)
columnAdjustPregReplace($type, $xadj, $yadj, $pattern, $subject)
Write($h, $txt, $currentx=0, $link='', $directionality='ltr', $align='', $fill=0)
RoundedRect($x, $y, $w, $h, $r, $style='')
$original_default_font_size
printobjectbuffer($is_table=false, $blockdir=false)
_tableGetMaxRowHeight($table, $row)
AddFont($family, $style='')
PaintDivBB($divider='', $blockstate=0, $blvl=0)
$allow_charset_conversion
_reverseTableDir(&$table)
_setAutoFooterHeight(&$htmlf)
IndexEntry($txt, $xref='')
AddCustomProperty($key, $value)
CircularText($x, $y, $r, $text, $align='top', $fontfamily='', $fontsize=0, $fontstyle='', $kerning=120, $fontwidth=100, $divider='')
WriteCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $currentx=0)
Image($file, $x, $y, $w=0, $h=0, $type='', $link='', $paint=true, $constrain=true, $watermark=false, $shownoimg=true, $allowvector=true)
restoreInlineProperties(&$saved)
Shaded_box($text, $font='', $fontstyle='B', $szfont='', $width='70%', $style='DF', $radius=2.5, $fill='#FFFFFF', $color='#000000', $pad=2)
IndexEntrySee($txta, $txtb)
WriteHTML($html, $mode=HTMLParserMode::DEFAULT_MODE, $init=true, $close=true)
_dounderline($x, $y, $txt, $OTLdata=false, $textvar=0)
SetCompression($compress)
_tableColumnWidth(&$table, $firstpass=false)
$displayDefaultOrientation
columnAdjustAdd($type, $k, $xadj, $yadj, $a, $b, $c=0, $d=0, $e=0, $f=0)
SetDColor($col, $return=false)
tabs2spaces_callback($matches)
OverWrite($file_in, $search, $replacement, $dest=Destination::DOWNLOAD, $file_out="mpdf")
AutosizeText($text, $w, $font, $style, $szfont=72)
_getCharWidth(&$cw, $u, $isdef=true)
Rotate($angle, $x=-1, $y=-1)
$hyphenationDictionaryFile
_printListBullet($x, $y, $size, $type, $color)
DefHTMLFooterByName($name, $html)
SetWatermarkText($txt='', $alpha=-1)
_table2cellBorder(&$tableb, &$cbdb, &$cellb, $bval)
all_entities_to_utf8($txt)
watermarkImg($src, $alpha=0.2)
SetWatermarkImage($src, $alpha=-1, $size='D', $pos='F')
SetFooterByName($name, $side='O')
GetCharWidth($c, $addSubset=true)
StopTransform($returnstring=false)
Ellipse($x, $y, $rx, $ry, $style='S')
SetBackground(&$properties, &$maxwidth)
Ln($h='', $collapsible=0)
static getSizeFromName($name)
static get_ucd_record($code)
const UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK
static get($array, $key, $default=null)
static containsPercentChar($string)
static removePercentChar($string)
static codeHex2utf($hex, $lo=true)
static strcode2utf($str, $lo=true)
static code2utf($num, $lo=true)
useTemplate($tpl, $x=0, $y=0, $width=null, $height=null, $adjustPageSize=false)
importPage($pageNumber, $box=PageBoundaries::CROP_BOX, $groupXObject=true)
AddPage($orientation='', $size='', $rotation=0)
Link($x, $y, $w, $h, $link)
SetLink($link, $y=0, $page=-1)
SetFont($family, $style='', $size=0)
$html
inisialisasi variabel dari hasil perekaman halaman
if(strstr($tempfilename,'/')||strstr($tempfilename,'\\')) $name